in reply to Re^2: How to return values from a hash?
in thread How to return values from a hash?
Does that make it more clear?
Nope. Just a big mess of unintelligible console output.
Returning a hashref from a subroutine is simple and straightforward:
%hash = ( subhash1 => { a=>1, b=>2 }, subhash2 => { c=>3, d=>4 } );; sub getSubhash { return $hash{ $_[0] } };; pp getSubhash( 'subhash1' );; { a => 1, b => 2 } pp getSubhash( 'subhash2' );; { c => 3, d => 4 }
Which means you must be doing something wrong.
So, how about you post:
Then we'll be able to point out what you are doing wrong.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: How to return values from a hash?
by perl-diddler (Chaplain) on Mar 30, 2013 at 03:40 UTC | |
by CountZero (Bishop) on Mar 30, 2013 at 10:02 UTC | |
by perl-diddler (Chaplain) on Mar 30, 2013 at 15:06 UTC | |
by Athanasius (Archbishop) on Mar 31, 2013 at 07:16 UTC | |
by perl-diddler (Chaplain) on Apr 21, 2013 at 10:26 UTC | |
by BrowserUk (Patriarch) on Mar 30, 2013 at 04:38 UTC | |
by perl-diddler (Chaplain) on Mar 30, 2013 at 14:52 UTC | |
by poj (Abbot) on Mar 30, 2013 at 08:35 UTC | |
by perl-diddler (Chaplain) on Mar 30, 2013 at 14:46 UTC |