Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

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

by ysth (Canon)
on Jan 29, 2004 at 00:49 UTC ( #324846=note: print w/ replies, xml ) Need Help??


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
Node Status?
node history
Node Type: note [id://324846]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (7)
As of 2015-07-04 02:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (57 votes), past polls