in reply to Re: (zdog) Re: removing x from a list
in thread removing x from a list
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.opendir (SONGS, $song_dir); @songs = sort grep { !/^\.\.?$/ } readdir(SONGS); closedir (SONGS);
Can actually be combined into a single equivalent one: @songs = sort readdir(SONGS); Just as:@songs = readdir(SONGS); @songs = sort @songs;
Can be converted to: $x = $z + $y;$x = $y; $x = $z + $x;
|
|---|