in reply to hash of arrays -- Im missing something

I see a couple of problems that use warnings; use strict; would expose right away. First,

$player_info{$ipaddr} = [ qw($nickname $userid $player_req) ]; # and... $player_info{$1} = [ qw($value1 $value2) ];
should be
$player_info{$ipaddr} = [ $nickname, $userid, $player_req ]; # and... $player_info{$1} = [ $value1, $value2 ];
because qw() does not interpolate the value of variables.

Second,

while ( (my $nkey, my @nvalue) = each %player_info ) { #stuff }
is incorrect, the second of the pair is a scalar arrayref:
while ( (my $nkey, my $nvalue) = each %player_info ) { # stuff with $nvalue->[$ndx] }
Sorry, I didn't follow what you were doing in that block.

After Compline,
Zaxo

Replies are listed 'Best First'.
Re: Re: hash of arrays -- Im missing something
by snafu (Chaplain) on Jul 26, 2001 at 07:22 UTC
    Excellent. The $_ = [ $value1, $value2 ]; was very helpful. The script is using warnings. Nothing more than the dreaded unitialized value was ever popped out. Of course, that is because my regex was skewed. Its all fixed now.

    Thanks!

    ----------
    - Jim