468,321 Members | 1,711 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,321 developers. It's quick & easy.

Anonymous Array

Hi ,

How to get the length of Anonymous array.
In my code sometimes the Anonymous array is becoming empty want to go a head only if the array is not empty...how to do??

Thanks
Jul 10 '08 #1
1 3274
KevinADC
4,059 Expert 2GB
You don't really need to check the length if all you want to know is if the array has something in it or not, you can just use "if" with "!" to see if it does:

Expand|Select|Wrap|Line Numbers
  1. @array = ();
  2. $array_ref = \@array;
  3. if (! @{$array_ref}) {
  4.    print "Empty";
  5. };
Note you do have to dereference the array reference to check its status (empty or not).
Jul 10 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

5 posts views Thread by JKop | last post: by
5 posts views Thread by Martin Vorbrodt | last post: by
11 posts views Thread by G Fernandes | last post: by
6 posts views Thread by Anders Thomsen | last post: by
7 posts views Thread by moondaddy | last post: by
60 posts views Thread by jacob navia | last post: by
12 posts views Thread by =?Utf-8?B?U2VyZ2V5IFBvYmVyZXpvdnNraXk=?= | last post: by
reply views Thread by NPC403 | last post: by
1 post views Thread by howard w | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.