in reply to can't use string as an array ref
Most likely this means you've inserted an array into a hash like this:
my $somearray = qw ( servername ); $server_list_hash{$server} = @somearray;
Which hasn't done what you thought, because it's done an assignment in a scalar context, which means it's assigned the number of elements in @somearray.
What you would actually need to do would be:
$server_list_hash{$server} = [@somearray];
Be careful with something like:
$server_list_hash{$server} = \@somearray;
Because this will break if you reuse @somearray (e.g. it's not lexically scoped) because you'll be using the same reference each time
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: can't use string as an array ref
by fionbarr (Friar) on Mar 26, 2015 at 17:18 UTC | |
by kennethk (Abbot) on Mar 26, 2015 at 17:51 UTC |