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