|
|
| Perl Monk, Perl Meditation | |
| PerlMonks |
Re: Another Q about piping Perlby stefp (Vicar) |
| on Oct 11, 2001 at 23:18 UTC ( [id://118365]=note: print w/replies, xml ) | Need Help?? |
This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.
The idiom to execute perl statements on and print the result of each line of a file is
perl -pe 'perl_statements' < file or some_command | perl -pe 'perl_statements' 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:
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 "$_ " }
TMTOWTDI -- stefp
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||