gube has asked for the wisdom of the Perl Monks concerning the following question:
Hi monks,
I use this below code, I am not getting output exactly, what i expect the value to be stored in hash
use Data::Dumper; %fruits=(); @arr = ([1,1],[1,2],[3,5],[6,7]); for (@arr) { $a = $_->[0]; $b = $_->[1]; $fruits{$a} = $b; } print Dumper(\%fruits);
I want the output format as like this:
$VAR1 = { '6' => 7, '1' => 1,2, '3' => 5 };
My input as mentioned in the above you may use any code or module. Please help the code.
Thanks in Advance.
Regards,
Gubendran.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to store this value in Hash ?
by jhourcle (Prior) on Mar 21, 2005 at 11:41 UTC | |
|
Re: How to store this value in Hash ?
by gopalr (Priest) on Mar 21, 2005 at 12:33 UTC | |
by manav (Scribe) on Mar 21, 2005 at 13:03 UTC | |
|
Re: How to store this value in Hash ?
by tlm (Prior) on Mar 21, 2005 at 11:59 UTC | |
by manav (Scribe) on Mar 21, 2005 at 12:06 UTC | |
|
Re: How to store this value in Hash ?
by ikegami (Patriarch) on Mar 21, 2005 at 16:10 UTC | |
|
Re: How to store this value in Hash ?
by reasonablekeith (Deacon) on Mar 21, 2005 at 14:29 UTC | |
|
Re: How to store this value in Hash ?
by demerphq (Chancellor) on Mar 21, 2005 at 14:43 UTC | |
|
Re: How to store this value in Hash ?
by sh1tn (Priest) on Mar 21, 2005 at 11:25 UTC |