Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Answer: undef vs. $foo = 0

( #163711=categorized answer: print w/ replies, xml ) Need Help??

Q&A > input and output > undef vs. $foo = 0 contributed by crazyinsomniac

The best method is
foreach $foo(@foo) { $bar = $some + $thing; }
no need for an intermediary step unless you're doing something with $bar.

If $bar has a default value, set it to that value, otherwise undef.

Comment on Answer: undef vs. $foo = 0
Download Code
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2015-07-05 09:59 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 (61 votes), past polls