in reply to Perl oneliner problem with -F switch

But my question is why the code below does not work? I.e. it produces blank output:

ls -al | perl -F// -lne '$i=0; @a = map {$i++%2 ? $_ : " "} @F; print @a;'

Probably because you actually forgot that -a switch you're also talking about.

ls -al | perl -F// -alne '$i=0; @a = map {$i++%2 ? $_ : " "} @F; print @a;' works perfectly fine here.

  • Comment on Re: Perl oneliner problem with -F switch