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.
In reply to Re: Perl oneliner problem with -F switch
by Fang
in thread Perl oneliner problem with -F switch
by bfilipow
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |