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

Re^2: reading several lines in a gulp

by raybies (Chaplain)
on Apr 27, 2011 at 12:20 UTC ( [id://901553]=note: print w/replies, xml ) Need Help??


in reply to Re: reading several lines in a gulp
in thread reading several lines in a gulp

Why is scalar used in that? What's the effect? I'm staring crosseyed at this very useful solution, can someone decompress this one for me?

Thanks ahead of time for all you experts and your great solutions...

--Ray

Replies are listed 'Best First'.
Re^3: reading several lines in a gulp
by moritz (Cardinal) on Apr 27, 2011 at 12:58 UTC
Re^3: reading several lines in a gulp
by Eliya (Vicar) on Apr 27, 2011 at 12:58 UTC
    Why is scalar used in that? What's the effect?

    push imposes list context (you can push more than one element in one statement), and <$file> would read the whole file at once in list context (as pointed out in the OP).

    In other words, without scalar, the whole file would be read in the first iteration, which would kind of defeat the purpose of the exercise...

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2024-04-24 20:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found