you'll need to dereference it..

this would work for you:

perl -e "$ref=[qw(1 2 3)]; print scalar @$ref"

regards,

Jos Boumans


----- Original Message ----- 
From: "Hamish Whittal" <[EMAIL PROTECTED]>
To: "perl beginners" <[EMAIL PROTECTED]>
Sent: Friday, August 31, 2001 5:24 PM
Subject: Getting the length of an array that is a reference...


> Hi,
> 
> I have a reference to an array $ref_arr
> 
> I want the length of the array. normally just getting the length one
> would write something along the lines of:
> $length = @#array; # Unless I am mistaken.
> 
> How do I find the length if I have a reference?
> 
> Cheers
> Hamish
> -- 
> Hamish Whittal QED Technologies Tel: +27 21 448 9291
> [EMAIL PROTECTED] Fax: +27 21 448 9551
> `The' Linux Services Company Cel: +27 82 803 5533
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to