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 through the whole array until I run out of
>>> elements)? Thanks.
>>
>> Using an array in scalar context is *not* deprecated.
>>
>> Since you haven't shown any code I would have to guess that you are using
>> defined() on an array which *is* deprecated.
>
> Actually, what I did was something like

"what I did was something like" is not the same as "this is the actual code
that produced the warning".


> my @arr = (a,b,c,d,e);
> $length = $arr;

@arr and $arr are two separate variables, the second of which is not even an
array.  There is nothing in that example that should produce a warning message.




John
-- 
Perl isn't a toolbox, but a small machine shop where you can special-order
certain sorts of tools at low cost and in short order.       -- Larry Wall

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