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?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: ls piped tpo perl -pe runs indefintely
by zwon (Abbot) on May 01, 2012 at 13:47 UTC | |
by ISAI student (Scribe) on May 01, 2012 at 16:26 UTC | |
by Anonymous Monk on May 01, 2012 at 16:30 UTC | |
|
Re: ls piped tpo perl -pe runs indefintely
by JavaFan (Canon) on May 01, 2012 at 13:45 UTC | |
|
Re: ls piped tpo perl -pe runs indefintely
by Anonymous Monk on May 01, 2012 at 13:46 UTC | |
by Anonymous Monk on May 01, 2012 at 13:59 UTC |