http://www.perlmonks.org?node_id=642374


in reply to Re^4: How to write a program to read stdin or command line?
in thread How to write a program to read stdin or command line?

With -p, whilst you can conditionally undef $_ to avoid it being printed; if you are also using -l, you will get unwanted blank lines:

C:\test>type junk.txt 1 2 3 4 5 C:\test>perl -nle"$_ & 1 and print" junk.txt 1 3 5 C:\test>perl -ple"$_ & 1 or undef $_ and next" junk.txt 1 3 5

And in fact the next in your example serves no purpose:

C:\test>perl -ple"$_ & 1 or undef $_" junk.txt 1 3 5

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.