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

Re^2: perl leaving out the last value?

by Eliya (Vicar)
on Apr 17, 2012 at 22:14 UTC ( #965564=note: print w/ replies, xml ) Need Help??


in reply to Re: perl leaving out the last value?
in thread perl leaving out the last value?

while (defined($symbol = <IN>))

With this particular construct, Perl automatically adds the defined(), so you can safely omit it if you prefer brevity.

$ perl -MO=Deparse -e'while ($symbol = <IN>) { chomp($symbol) }' while (defined($symbol = <IN>)) { chomp $symbol; } -e syntax OK


Comment on Re^2: perl leaving out the last value?
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (13)
As of 2015-07-31 19:01 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 (280 votes), past polls