Rob Richardson wrote:
> 
> I will take your word that "$a = (3, 2, 1);" returns 1.  I think I was
> thinking of "$a = [3, 2, 1];", in which an anonymous array would be
> created and $a would return 3, the number of elements in the array.
> 
> NOT!!!
> 
> The above is what I was going to say when I started typing this, but
> then I remembered.  In "$a = [3, 2, 1];", $a gets a reference to the
> anonymous array.  I was going to finish this thought with a way to get
> the number of elements in the anonymous array, but I realized I don't
> know how!  Also, this question could be important in my current
> project.  What's the best way to find the number of elements contained
> in an anonymous array to which you have a reference?

Basicly the same as with a real array only you have to dereference the
array reference.

my $number_of_elements = @$a;



John
-- 
use Perl;
program
fulfillment

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

Reply via email to