Non-deprecated way to capture array length

2006-10-09 Thread Marc Sacks
I needed to find out the length of an array and did it by referencing the array in scalar context. However, use warnings indicated that this is a deprecated feature. Is there a non-deprecated way to do this (other than looping through the whole array until I run out of elements)? Thanks. --

Re: Non-deprecated way to capture array length

2006-10-09 Thread Jeff Pang
I needed to find out the length of an array and did it by referencing the array in scalar context. However, use warnings indicated that this is a deprecated feature. Is there a non-deprecated way to do this (other than looping through the whole array until I run out of elements)? Thanks.

Re: Non-deprecated way to capture array length

2006-10-09 Thread Derek B. Smith
--- Marc Sacks [EMAIL PROTECTED] wrote: I needed to find out the length of an array and did it by referencing the array in scalar context. However, use warnings indicated that this is a deprecated feature. Is there a non-deprecated way to do this (other than looping through the whole

Re: Non-deprecated way to capture array length

2006-10-09 Thread John W. Krahn
Marc Sacks wrote: I needed to find out the length of an array and did it by referencing the array in scalar context. However, use warnings indicated that this is a deprecated feature. Is there a non-deprecated way to do this (other than looping through the whole array until I run out of

Re: Non-deprecated way to capture array length

2006-10-09 Thread Jeff Pang
I needed to find out the length of an array and did it by referencing the array in scalar context. However, use warnings indicated that this is a deprecated feature. Is there a non-deprecated way to do this (other than looping through the whole array until I run out of elements)? Thanks.

RE: Non-deprecated way to capture array length

2006-10-09 Thread Helliwell, Kim
-Original Message- From: Jeff Pang [mailto:[EMAIL PROTECTED] Sent: Monday, October 09, 2006 7:48 AM To: beginners Subject: Re: Non-deprecated way to capture array length I needed to find out the length of an array and did it by referencing the array in scalar context. However, use

RE: Non-deprecated way to capture array length

2006-10-09 Thread Jeff Pang
-- Perhaps I'm behind the times here, but what's wrong with: my $num = $#array ?? [EMAIL PROTECTED] ~]$ perl -Mstrict -Mwarnings -le 'my @arr=qw/aa bb cc/;print $#arr' 2 [EMAIL PROTECTED] ~]$ perl -Mstrict -Mwarnings -le 'my @arr=qw/aa bb cc/;print scalar @arr' 3 They are not the

RE: Non-deprecated way to capture array length

2006-10-09 Thread Helliwell, Kim
-Original Message- From: Jeff Pang [mailto:[EMAIL PROTECTED] Sent: Monday, October 09, 2006 8:25 AM To: beginners Subject: RE: Non-deprecated way to capture array length -- Perhaps I'm behind the times here, but what's wrong with: my $num = $#array ?? [EMAIL PROTECTED] ~]$ perl

Re: Non-deprecated way to capture array length

2006-10-09 Thread John W. Krahn
Marc Sacks wrote: John W. Krahn wrote: Marc Sacks wrote: I needed to find out the length of an array and did it by referencing the array in scalar context. However, use warnings indicated that this is a deprecated feature. Is there a non-deprecated way to do this (other than looping