|
|
| Perl: the Markov chain saw | |
| PerlMonks |
ls piped tpo perl -pe runs indefintelyby ISAI student (Scribe) |
| on May 01, 2012 at 13:12 UTC ( #968240=perlquestion: print w/ replies, xml ) | Need Help?? |
|
ISAI student has asked for the
wisdom of the Perl Monks concerning the following question:
Hello all. I have tried to do something simple. Do ls, pipe it to perl -ne (using xargs) and print. And it runs indefintely. I have tried something simple, like printing out only the directories. See code below ls | xargs perl -ne ' map { print $_ , "\n" if ( -d $_ ) ; } @ARGV 'This runs almost indefintely. However this gets me what I need: ls | xargs perl -ne ' $a = shift ; print $a "\n" if (-d $a) ; 'why?
Back to
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||||