in reply to Interpolating an array element as a hash name.
Your brain is still doing C, C++, Java, whatever you used to do before perl.
While C style for loops do work in Perl, it's better to think of loops in terms of lists, arrays, sets:
for my $i ( 0..2 ) { for my $j ( 0..2 ) { ... } }
But why do you have these hashes named $a{0}, $a{1}, $a{2}? Those sound like arrays, not hashes. In fact, I kept accidentally using square brackets instead of curlies, and then had to repair them.
Better yet, why not start thinking in meaningful terms, for example %expense, %income, %profits over the keys qw( January February March .... ). Hmmm ... still sounds like arrays.
What are you really trrying to achieve? As opposed to how you think you need to implement it ...?
--
TTTATCGGTCGTTATATAGATGTTTGCA
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Interpolating an array element as a hash name.
by yam (Novice) on Mar 15, 2004 at 13:27 UTC | |
by TomDLux (Vicar) on Mar 16, 2004 at 00:28 UTC |