You can use defined() function by checking for the
first element.
#!/usr/bin perl
use strict;
use warnings;
my @arr=(); ## empty
my $ref=\@arr; ##
if(!defined ($ref->[0]) {
# do your work here
}
if (!define ($arr->[0]) {
# do your work
}
--- dan <[EMAIL PROTECTED]> wrote: > or
>
> if (!$array[0]) {
> # it's empty
> }
>
> your choice :)
>
> dan
>
> "Nikola Janceski" <[EMAIL PROTECTED]>
> wrote in message
>
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > if(not @array){
> > # it's empty
> > }
> >
> > > -----Original Message-----
> > > From: Bryan Harris [mailto:[EMAIL PROTECTED]]
> > > Sent: Friday, October 04, 2002 11:58 AM
> > > To: Beginners Perl
> > > Subject: Check for empty array
> > >
> > >
> > >
> > >
> > > What's the easiest way to check whether an array
> is empty?
> > >
> > > I'm really feeling like a beginner today...
> > >
> > > - Bryan
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> > > For additional commands, e-mail:
> [EMAIL PROTECTED]
> > >
> >
> >
>
--------------------------------------------------------------------------
> --
> > --------------------
> > The views and opinions expressed in this email
> message are the sender's
> > own, and do not necessarily represent the views
> and opinions of Summit
> > Systems Inc.
> >
>
>
>
> --
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
>
__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]