each line is stored in $_ on which perl_statements act.
Here you want to print all the files in the $HOME/Mail
directory. An all perl solution is:
map{ -f $_ and print "$_ " } <$ENV{HOME}/MAIL/*>
Some people consider using map on empty context is bad form. I don't.
They would propose instead:
for(<$ENV{HOME}/MAIL/*>) { -f $_ and print "$_ " }
or
-f $_ and print "$_ " for <$ENV{HOME}/MAIL/*>
TMTOWTDI
-- stefp
In reply to Re: Another Q about piping Perl
by stefp
in thread Another Q about piping Perl
by Elvis
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |