I have a possible re-write for your program. It gets rid of the system calls (the 'find' and the 'rm'). I've used references; the %by_genre hash has the different genres as keys, and its values are array references. The array references hold hash references. If you can't follow the code, ask the list. I've got comments in the code.
You've done: my @temp = @thing; while ($x = pop @temp) { ... } countless times. Why not use a for loop like I've done? Also, the new way I'm printing to the different genre files is much more efficient. You were iterating over the @entries array each time you were printing the files matching a genre. My approach iterates over the hash once, and over each array reference once. #!/usr/bin/perl # to avoid `find /ogg` use File::Find; use strict; use warnings; use constant DEBUG => 1; my %by_genre; find(\&get_ogg, "/ogg"); # to avoid `rm ...` unlink glob "/ogg/m3u/*.m3u"; open MASTER, "> /ogg/m3u/All_artists.m3u" or die "Can't create /ogg/m3u/all_artists.m3u: $!"; print MASTER "$_\n" for @files; close MASTER; # iterate over the different genres # print the filenames in that genre to the m3u file for my $genre (keys %by_genre) { open PLAYLIST, "> /ogg/m3u/$genre.m3u" or die "Can't create /ogg/m3u/$genre.m3u: $!"; print PLAYLIST "$_->{fullpath}\n" for @{ $by_genre{$genre} }; close PLAYLIST; } sub get_ogg { # only do stuff for *.ogg files return unless /\.ogg$/; my $full = $File::Find::name; my ($ogg, $genre, $artist, $album, $df) = split '/', $full, 4; my ($disc, $file) = $df =~ m{(.*)/(.*)} ? ($1, $2) : (1, $df); # %by_genre = ( some_genre => [ entry, entry, ... ] ) # each entry is a hash reference push @{ $by_genre{$genre} }, { genre => $genre, artist => $artist, album => $album, disc => $disc, file => $file, fullpath => $full, }; warn << "DEBUGGING" if DEBUG; Genre: $genre Artist: $artist Album: $album File: $file Full Path: $full DEBUGGING } __END__ -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ <stu> what does y/// stand for? <tenderpuss> why, yansliterate of course. [ I'm looking for programming work. If you like my work, let me know. ] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]