>
>>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.
>>
>
>How do you write it? I can get it like:
>
>$ perl -Mstrict -Mwarnings -le 'my @arr=qw/aa bb cc/;print length(join 
>"",@arr)'  
>6
>

Sorry, if you mean the number of elements in an array,then it should be: 
my $num = scalar @array;

--
Jeff Pang
NetEase AntiSpam Team
http://corp.netease.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to