Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: command line perl reading from STDIN

by AnomalousMonk (Abbot)
on Jan 23, 2013 at 00:48 UTC ( #1014820=note: print w/ replies, xml ) Need Help??


in reply to command line perl reading from STDIN

Sometimes it's useful to let Perl tell you what it thinks about the code you give it to execute (e.g., "where does the fourth lineread come from?"):

>perl -MO=Deparse -ne "$s=<>;<>;<>;chomp($s);print length($s).\"\n\"; " LINE: while (defined($_ = <ARGV>)) { $s = <ARGV>; <ARGV>; <ARGV>; chomp $s; print length($s) . "\n"; } -e syntax OK

Use  -MO=Deparse,-p   for even gorier details. See B::Deparse and O.


Comment on Re: command line perl reading from STDIN
Select or Download Code
Replies are listed 'Best First'.
Re^2: command line perl reading from STDIN
by perlhappy (Novice) on Jan 31, 2013 at 16:25 UTC
    Thanks. That's really great... Really helps with understanding whats actually going on.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1014820]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2015-07-30 09:51 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 (271 votes), past polls