Hi,
How can I obtain the size of an array that was passed as a reference.
ex:
&something(\@v1,\@v2);
sub something{
my($arr1,$arr2)=@_;
#get size of arr1?
}
I know I can loop through all the items by setting up a foreach(@$arr) but the regular old $# doesn't seem to work.
I also don't want to make a copy of this as an array, I want to keep it as a reference.
Thanks!
How can I obtain the size of an array that was passed as a reference.
ex:
&something(\@v1,\@v2);
sub something{
my($arr1,$arr2)=@_;
#get size of arr1?
}
I know I can loop through all the items by setting up a foreach(@$arr) but the regular old $# doesn't seem to work.
I also don't want to make a copy of this as an array, I want to keep it as a reference.
Thanks!