Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^2: To test empty array in perl

by nagalenoj (Friar)
on Apr 27, 2010 at 04:44 UTC ( #837020=note: print w/replies, xml ) Need Help??


in reply to Re: To test empty array in perl
in thread To test empty array in perl

print "Array isn't empty.Array Values:@array\n" if($array[0]);

This won't tell you whether the array is empty.

What happens when the first index of array has undef or 0.?

# my @array = (0, undef, 1, 2, 3); my @array = (undef, undef, 1, 2, 3); print "Array isn't empty.Array Values:@array\n" if($array[0]);

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2016-10-01 20:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?






    Results (7 votes). Check out past polls.