in reply to Mixing up indices in multidimensional hash
Are you certain you don't want:@{$tbls{'12p'}} = [ 't72', 't73', 't74', 't75', 't76', 't77' ];
In addition, you can clean up your code considerably with the qw operator, eg.:$tbls{'12p'} = [ 't72', 't73', 't74', 't75', 't76', 't77' ];
$tbls{'12p'} = [ qw/ t72 t73 t74 t75 t76 t77 / ];
Are you running with use strict? If not, you probably should be.for $b (0 .. $#price) { ...
Update: One more thing--looping over indices is rarely needed, and makes for ugly code. I think your loops should be more like:
This saves you the mental overhead of having to process all those array lookups.for my $price (@price) { $sql = 'SELECT respondent FROM'; for my $table (@{$tbls{$price}}) { ... } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Mixing up indices in multidimensional hash
by Tanktalus (Canon) on Feb 16, 2005 at 19:46 UTC | |
|
Re^2: Mixing up indices in multidimensional hash
by punch_card_don (Curate) on Feb 16, 2005 at 19:59 UTC |