On Aug 23, 2:00 am, [EMAIL PROTECTED] (Justin The Cynical) wrote:
> Add the name of the array to a 'master array' list of the machine
> groups
> Then create another array, which would be referenced by the group
> name, and contains the machines associated with the group.

> The script runs if I do not use strict (which I consider a Bad
> Thing).  But when I run it with strict, I receive the following error:
>
> Can't use string ("prod01") as an ARRAY ref while "strict refs" in use

perldoc -q "variable name"

> Am I missing something really basic that is covered in the Llama (3rd
> edition),

No, because it's not basic.  You should be using a multi-dimensional
structure, as Lists User recommended.  Rather than storing the name of
an array, store the name of a key to your hash of arrays, and let the
value be a reference to an anonymous array.

my %array_named;
$array_named{foo} = [ 1, 2, 3, 4];
$array_named{bar} = [qw/ alpha beta gamma delta/];
for my $name (keys %array_named) {
   print "$name:  @{$array_named{$name}}\n";
}

See also:
perldoc perlreftut
perldoc perllol
perldoc perldsc

Hope that helps,
Paul Lalli


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to