Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Dear All,
I was using code that I found on PerlMonks page but can't seem to figure out how to use it. I have a set of hash reference created with;
$idx = 0; foreach $n (@IDs) { push @{$An{$n}->{b}} , $bb[$idx]; push @{$An{$n}->{c}} , $cc[$idx]; push @{$An{$n}->{e}} , $ee[$idx]; push @{$An{$n}->{d}} , $dd[$idx]; push @{$An{$n}->{f}} , $ff[$idx]; $idx++; }
How can I then for each $ID print values of corresponging position? Such as $ID[0], @{$An{$n}->{b}}[0]? etc. Btw is it a better practice to declare arguments with 'my' at the begining or just in code? I end up with a code ehader having declaration of 40+ variables (not always possible to do subs). Thanks for help.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Print elements of hash references
by RichardK (Parson) on Mar 31, 2012 at 18:06 UTC | |
by Anonymous Monk on Mar 31, 2012 at 18:21 UTC | |
by chromatic (Archbishop) on Mar 31, 2012 at 18:33 UTC | |
by Happy-the-monk (Canon) on Mar 31, 2012 at 18:37 UTC | |
by RichardK (Parson) on Mar 31, 2012 at 18:33 UTC | |
Re: Print elements of hash references
by stevieb (Canon) on Mar 31, 2012 at 18:40 UTC | |
by Anonymous Monk on Mar 31, 2012 at 20:26 UTC |
Back to
Seekers of Perl Wisdom