in reply to Re: Re: Re: $_ and nested while loops w/angle operator
in thread $_ and nested while loops w/angle operator
The fundamental point is that a reference is just another kind of scalar value. Anywhere you can put 3 or "ouch", you can put a reference. So an arrayref need not be the simple scalar variable in the example ($aref), it could be an element of an array ($refs[9]) or the value of a hash element ($hits{"blue"}).
So, given that $data{$query} contains an array ref, you can push things on that array via
push @{ $data{$query} }, $thing;
To return a hash by reference, you treat the hash variable as an opaque container. Like so:
return \%data;
jdporter
The 6th Rule of Perl Club is -- There is no Rule #6.
|
|---|