Re: Empty Array

2004-01-02 Thread James Edward Gray II
On Jan 2, 2004, at 10:18 AM, Jeff Westman wrote: What is the proper way to test if an array is empty ? Probably the easiest is: if (@array) { # not empty } else { # empty } # or... unless (@array) { # empty } This works because an array in scalar context returns the numbe

Empty Array

2004-01-02 Thread Jeff Westman
What is the proper way to test if an array is empty ? TIA -JW __ Do you Yahoo!? Find out what made the Top Yahoo! Searches of 2003 http://search.yahoo.com/top2003 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: How Do I initialize an empty array

2003-10-29 Thread Tore Aursand
On Tue, 28 Oct 2003 11:53:44 -0700, Wiggins d Anconia wrote: > or if you know the length of the array ahead of time: > > my @rows = ('','',''); I prefer the following instead: my @rows = ('') x 3; Easier to read...? -- Tore Aursand <[EMAIL PROTECTED]> -- To unsubscribe, e-mail: [EMAIL P

Re: How Do I initialize an empty array

2003-10-28 Thread Rob Dixon
<[EMAIL PROTECTED]> wrote: > > How Do I initialize an empty array so thtat I don't get an unitiialized > error? > > ... > my @rows; > > I thought I could do something like @rows = new (); but it's not working. You don't. my @rows; declares a

Re: How Do I initialize an empty array

2003-10-28 Thread perl
thanks. it works. @rows=(); -- > > >> How Do I initialize an empty array so thtat I don't get an unitiialized >> error? >> >> ... >> my @rows; >> >> I thought I could do something like @rows = new (); but it's not >> working. &

Re: How Do I initialize an empty array

2003-10-28 Thread Wiggins d Anconia
> > > > How Do I initialize an empty array so thtat I don't get an unitiialized > > error? > > > > ... > > my @rows; > > > > I thought I could do something like @rows = new (); but it's not working. > > > > Drop the 

Re: How Do I initialize an empty array

2003-10-28 Thread Wiggins d Anconia
> How Do I initialize an empty array so thtat I don't get an unitiialized > error? > > ... > my @rows; > > I thought I could do something like @rows = new (); but it's not working. > Drop the 'new': my @rows = (); http://danconia.org -- T

How Do I initialize an empty array

2003-10-28 Thread perl
How Do I initialize an empty array so thtat I don't get an unitiialized error? ... my @rows; I thought I could do something like @rows = new (); but it's not working. thanks - eMail solutions by http://www.swanmail.com -- To unsubscri

Re: Check for empty array

2002-10-06 Thread Dharmender Rai
Yes you are right !! Thanx Dharmender Rai --- "John W. Krahn" <[EMAIL PROTECTED]> wrote: > Dharmender rai wrote: > > > > You can use defined() function by checking for the > > first element. > > No, checking the first element of an array will tell > you whether or not > the first element of

Re: Check for empty array

2002-10-05 Thread John W. Krahn
Dharmender rai wrote: > > You can use defined() function by checking for the > first element. No, checking the first element of an array will tell you whether or not the first element of the array is defined, it will not tell you if the array is empty. John -- use Perl; program fulfillment -

Re: Check for empty array

2002-10-05 Thread Michael Fowler
I just noticed this thread, so forgive me if someone has already mentioned this, or if I'm missing the original point. I just saw some bad examples of how to accomplish what the subject asks, and felt I should chime in. The idiomatic method for checking if an array has elements is simply: i

Re: Check for empty array

2002-10-04 Thread Dharmender Rai
mpty > > } > > > > > -Original Message- > > > From: Bryan Harris [mailto:[EMAIL PROTECTED]] > > > Sent: Friday, October 04, 2002 11:58 AM > > > To: Beginners Perl > > > Subject: Check for empty array > > &g

Re: Check for empty array

2002-10-04 Thread James Edward Gray II
gt; -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

Re: Check for empty array

2002-10-04 Thread Jeremy Vinding
On Fri, 2002-10-04 at 10:21, [EMAIL PROTECTED] wrote: > or > > if (!$array[0]) { > # it's empty > } > > your choice :) > > dan not quite... try that on this array: @array = qw(0 1 2 3 4 5 6); jjv -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTE

Re: Check for empty array

2002-10-04 Thread dan
: 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

Re: Check for empty array

2002-10-04 Thread John W. Krahn
Bryan Harris wrote: > > What's the easiest way to check whether an array is empty? An array in a scalar context returns the number of elements in the array. if ( @array == 0 ) { # explicit test for zero elements unless ( @array ) { # implicit test for zero elements John -- use Perl; program

Re: Check for empty array

2002-10-04 Thread James Edward Gray II
HANDLE_EMPTY() unless @array; James Gray On Friday, October 4, 2002, at 10:57 AM, Bryan Harris wrote: > > > 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 additio

RE: Check for empty array

2002-10-04 Thread Nikola Janceski
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 c

Check for empty array

2002-10-04 Thread Bryan Harris
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]