in reply to Re^2: Shared variable not changing?
in thread Shared variable not changing?
...the queue that resides in $mcvpservers->{$server}->[2]. Do I have to push to that reference somehow?
If that's an array reference, you probably don't want
my @queue = $mcvpservers->{$server}->[2];
but rather
my $queue = $mcvpservers->{$server}->[2]; ... push @$queue, ...
Update: as you have it, your array ref (queue) will be assigned to the first element of @queue, but whatever you push onto @queue will be added outside of what is pointed to by the array ref. Consider
use Data::Dumper; our @queue = (qw(stuff in queue)); my $server = "name"; $mcvpservers->{$server}->[2] = \@queue; # ... my @queue = $mcvpservers->{$server}->[2]; push @queue, "morestuff"; print Dumper \@queue; __END__ $VAR1 = [ [ 'stuff', 'in', 'queue' ], 'morestuff' ];
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Shared variable not changing?
by Shades (Initiate) on Mar 17, 2009 at 11:03 UTC | |
by almut (Canon) on Mar 17, 2009 at 11:16 UTC |