http://qs1969.pair.com?node_id=222968


in reply to MP3 Sorter

Just a couple points:

Perl will usually 'do the right thing' if you use '/' as the directory separator. This way I can use your script on my linux box and Mac OS X laptop as well as my W2K system without edits:

chdir "d:/music/new";
is the same as
chdir "d:\\music\\new";

Instead of hard coding the directory (or using Getopt::*), you could do:

my $music_dir = shift || "d:/music/new"; chdir $music_dir;

Which allows 'mp3_sorter.pl' (to process d:\music\new) as well as 'mp3_sorter.pl /Volumes/myafp/mp3' (to process the mp3s on an AppleTalk share).

For little hacks, I'll embed string constants. But I try to make it easy to override them if at all possible.