473,386 Members | 1,679 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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 3445
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

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

Similar topics

5
by: JKop | last post by:
You know how from time to time, you want to have an array which you can access via: array_name; But also, you'd like the more user-friendly option: array_name.element1 array_name.element2
5
by: Martin Vorbrodt | last post by:
here's what i have: struct SCSI_CDB { .... union { struct { unsigned char address0; unsigned char address1; unsigned char address2;
11
by: G Fernandes | last post by:
I've heard some mention "anonymous" objects in c.l.c and other places (conversations), and I was wondering what exactly these are. Anonymous seems to imply that there is no name, but no name...
6
by: Anders Thomsen | last post by:
Hi, Is it possible on VB.NET to create anonymous arrays, e.g. passing arrays directly as a method-parameter instead of reference it from a variable. In C#, I can do this: string s = "Blah...
7
by: moondaddy | last post by:
I'm reading the book Wrox-Professional C# 2005 and it's trying to demonstrate an anonymous method in an event handler. I would not do this in a real app, but am trying to understand how this...
60
by: jacob navia | last post by:
Gnu C features some interesting extensions, among others compound statements that return a value. For instance: ({ int y = foo(); int z; if (y>0) z = y; else z=-y; z; }) A block enclosed by...
12
by: =?Utf-8?B?U2VyZ2V5IFBvYmVyZXpvdnNraXk=?= | last post by:
Hi, I need to initialize my class level dictionary (in .Net 2.0). I wanted to make it inline and employ anonymous methods as I do not use this code for anything else. Something similar to the...
11
by: pompair | last post by:
Hi, Does anyone know how to use anonymous types in a list? I mean, if you define in your code three anonymous types: new {FirstName = "Donald", LastName = "Duck"}; new {FirstName =...
3
by: ejaggers | last post by:
I'm teaching myself OOP by following examples. I can't figure out what this is doing for the life of me. I've read the explanation and still don't get it. Can anyone explain, plus is there a more...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.