TCLUG Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [TCLUG:18790] quick way to strip spaces...
On Thu, 15 Jun 2000, Troy Johnson wrote:
> #!/usr/bin/perl -w
>
> opendir D, ".";
> for (readdir D)
> {
> $oldname = $_;
> s/[ \[\]{}<>(),~]/_/g;
> s/\.MP3/.mp3/g;
> rename $oldname, $_;
> chmod 0655, $_;
> }
Now, the best thing about this script is that you can make it an
executable file, then put it in your cron file (the system-wide one is
/etc/crontab, usually) to have it run nightly (or weekly) as you
mentioned. You get your MP3s the way you want them -- with zero effort!
As an aside, I really admire Perl's power and maturity as a language. But
I can't stand the syntax! I mean, $_, yeah that's intuitive. And as much
as people recommend "Programming Perl", I just don't like that book. Some
people love the asides and puns, but I think they're annoying and distract
from the point. The function reference section is good, but I think
simple, basic Perl programming went out the window for it -- the first
chapter is pathetic.
Perl could definately use an annotated online manual like PHP's [1].
Then again, just IMHO.
Luke
[1] Anybody else notice the PHP guys deleted all the anotations!? That was
the best part...fools.