in reply to size of an array ref

# array: $ perl -wE 'my @a = qw/a b c/; say scalar @a' 3 # array ref: $ perl -wE 'my $a = [qw/a b c/]; say scalar @$a' 3

See also: perlreftut, References Quick Reference

Replies are listed 'Best First'.
Re^2: size of an array ref
by fionbarr (Friar) on Feb 24, 2012 at 13:00 UTC
    that makes sense...I might have a reference to a reference to an array...I've tried a lot of permutations and not gotten '3'...is it possible to get the size of a ref to a ref?
      @array; @$arrayref; @$$arrayrefref; @$$$arrayrefrefref; @$$$$arrayrefrefrefref; @$$$$$arrayrefrefrefrefref; @$$$$$$arrayrefrefrefrefrefref; ... etc ...
      $a= [1..10];$b=\$a;$c=\$b; $d=\$c;$e=\$d; $e=$$e while (ref($e) eq "REF"); print scalar @$e;