my's argument must be a variable name, or a list of variables in parens.
@chicago{ qw(tiger bob munch toy) }
is neither. I'm afraid you'll have to do
my %chicago; @chicago{ qw( tiger bob munch toy ) } = (); my %wisconsin; @wisconsin{ qw( tiger sara munch toy ) } = (); my %rockford; @rockford{ qw( tiger sara love toy ) } = ();
or
my %chicago = map { $_ => undef } qw( tiger bob munch toy ); my %wisconsin = map { $_ => undef } qw( tiger sara munch toy ); my %rockford = map { $_ => undef } qw( tiger sara love toy );
or even better (since you won't have to use exists)
my %chicago = map { $_ => 1 } qw( tiger bob munch toy ); my %wisconsin = map { $_ => 1 } qw( tiger sara munch toy ); my %rockford = map { $_ => 1 } qw( tiger sara love toy );
In reply to Re: Syntax Error using STRICT and Declaring Variable
by ikegami
in thread Syntax Error using STRICT and Declaring Variable
by awohld
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |