Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
Keep It Simple, Stupid
 
PerlMonks  

Re: Uncommon* but Useful Perl Command Line Options (for one-liners)

by ysth (Canon)
on Jan 28, 2004 at 19:49 UTC ( [id://324846]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Uncommon* but Useful Perl Command Line Options for One-liners

'-l' has a dual nature - on input it behaves like chomp(), automatically removing newline characters, while on output, as we've seen, it becomes the anti-chomp, adding newlines.
This needs more explication. -l's effect on input and output are not as parallel as this would imply.

-l's effect on input only applies to the LINE loop generated by -n or -p (by adding a chomp at the beginning). If -n and -p aren't specified, no input is changed.

-l's effect on output applies to all print (but not printf) statements, however situate (by virtue of setting $\).

Update: said $/ meant $\.

  • Comment on Re: Uncommon* but Useful Perl Command Line Options (for one-liners)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://324846]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.