in reply to Mixing up indices in multidimensional hash

You have:
@{$tbls{'12p'}} = [ 't72', 't73', 't74', 't75', 't76', 't77' ];
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'} = [ qw/ t72 t73 t74 t75 t76 t77 / ];

Update: I also see a loop that starts:
for $b (0 .. $#price) { ...
Are you running with use strict? If not, you probably should be.

Update: One more thing--looping over indices is rarely needed, and makes for ugly code. I think your loops should be more like:

for my $price (@price) { $sql = 'SELECT respondent FROM'; for my $table (@{$tbls{$price}}) { ... } }
This saves you the mental overhead of having to process all those array lookups.

Replies are listed 'Best First'.
Re^2: Mixing up indices in multidimensional hash
by Tanktalus (Canon) on Feb 16, 2005 at 19:46 UTC

    aw, heck, if you're going to start cleaning up the code with qw ...

    $tbls{'12p'} = [ 't72'..'t77' ];

    :-)))))

Re^2: Mixing up indices in multidimensional hash
by punch_card_don (Curate) on Feb 16, 2005 at 19:59 UTC
    Good point about the array declaration. Thanks.

    Actually, playing with it some more I'm finding that the problem is in the $sql = $sql.'...'

    I have my quotes in the wrong place, and, worse - the $sql just keeps getting tacked onto each iteration so it becomes a non-sensical command very quickly.

    I'll post it cleaned up in a few minutes.

    Forget that fear of gravity,
    Get a little savagery in your life.