in reply to Re: Re: $_ and nested while loops w/angle operator
in thread $_ and nested while loops w/angle operator
Update: I should've keep reading in perlreftut! The answer is here for anyone else that is still learning how to use references. Thank you all for your help.
Thanks for the further elaboration. For some reason, I am having a hard time understanding what is happening here:
push @{$data{$query}}, $_;
From perlreftut:
"If $aref contains a reference to an array, then you can put {$aref} anywhere you would normally put the name of an array. For example, @{$aref} instead of @array."
However, in your/my code, $query is a list, %data is a hash... so why the @{} notation? What's going on there that I'm missing?
My second question is: all of the code I posted is happening in a subroutine... how do I return a reference to the HoA? Is it:
return \@{$data};
Slightly boggled,
AH
Using perl 5.6.1 unless otherwise noted. Apache 1.3.27 unless otherwise noted. Redhat 7.1 unless otherwise noted.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: $_ and nested while loops w/angle operator
by jdporter (Paladin) on Apr 08, 2004 at 19:50 UTC |