in reply to Re: How To Count Lines In File?
in thread How To Count Lines In File?

Very interesting!

So, the meaning of -p is performed by textually including the loop around the actual code, so beginning with "}" will close the -p's while loop, and the final "{" will ballance the closing brace at the end of the expansion.

I never thought about that. I always just figured that built-in looping construct was done on a syntactic boundary, like:

while (<>) { eval $option_e; print }
only done in the parse-tree level, not by simply generating more source text!

So... that's not documented or to be relied on, right?

—John

Replies are listed 'Best First'.
Re: Re: Re: How To Count Lines In File?
by PodMaster (Abbot) on Jan 27, 2003 at 08:15 UTC
    `perl --help' or `perldoc perlrun'


    MJD says you can't just make shit up and expect the computer to know what you mean, retardo!
    ** The Third rule of perl club is a statement of fact: pod is sexy.

      Which states, “causes Perl to assume the following loop around your program”. It doesn't say that this is done by pasting text before parsing it. I always supposed it was done deeper in the interpreter, after parsing.