in reply to Re: (zdog) Re: removing x from a list
in thread removing x from a list

It might be a lot easier if you just got what you wanted out of the readdir call first:
opendir (SONGS, $song_dir); @songs = sort grep { !/^\.\.?$/ } readdir(SONGS); closedir (SONGS);
So in one line you get the sorted, filtered, directory listing. In this case, grep will only allow those array elements that are not '.' and '..' to pass through.

Perl commands can be stacked, and the output of one flows right into the other, in a right to left manner. This means that your two statements:
@songs = readdir(SONGS); @songs = sort @songs;
Can actually be combined into a single equivalent one:     @songs = sort readdir(SONGS); Just as:
$x = $y; $x = $z + $x;
Can be converted to:    $x = $z + $y;