Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
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 perusing the Monastery: (4)
As of 2015-04-18 10:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Who makes your decisions?







    Results (351 votes), past polls