Beginner wrote on Mon, Sep 18, 2006 at 03:24:08PM PDT: > On 18 Sep 2006 at 15:05, John W. Krahn wrote: > > opendir my $dh, $dir or die "Cannot open '$dir' $!"; > > > > print "$dir\n", > > map !/\A\.\.?\z/ && -d "$dir/$_" ? "$dir/$_\n" : (), > > readdir $dh; > > > > John > > That's looks nice John...but what is actually happening here. Some > sort of negation of \A (is that a character class?) and a directory > and/or something with a newline??? perldoc perlretut
The map section is making sure the return value from readdir isn't the special '.' or '..' directories (the regex portion), and making sure the return value from readdir is an actual directory and not a file. For every return value from readdir, "$dir/$_\n" is printed if it is a directory, otherwise nothing. - David -- "Difficilis facilis, iucundus acerbus--es idem: Nec tecum possum vivere nec sine te" -- Martial (popularized by u2) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>