Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^4: Using undef scalar as arrayref

by shemp (Deacon)
on Aug 12, 2005 at 21:07 UTC ( [id://483414]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Using undef scalar as arrayref
in thread Using undef scalar as arrayref

Actually the if is separate from the loop. If there are any elements in the arrayref a flag needs to be set for later that is separate from what is happening in the loop. So its something like this:
if ( $arrayref && @$arrayref ) { # set the flag } ... foreach my $element (@$arrayref) { # do stuff }
Of course i could set it in the loop, but then its being set multiple times.

I use the most powerful debugger available: print!

Log In?
Username:
Password:

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

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

    No recent polls found