T
Todd Bair
Hi,
I am trying to write all of my code using strict to improve my
code. However, the correct use of references for the following problem
eludes me. I have a work around, but I would like to know the correct
way to code this.
#!/usr/bin/perl -w
######################################
use strict;
#no strict 'refs'; ## work around ##
######################################
my %hash = qw(foo one bar two);
my $key;
foreach $key (keys %hash)
{
@{$key} = (0..5);
}
######################################
# later on in the program
######################################
foreach $key (keys %hash)
{
print "array $hash{$key} = ";
print join("\t",@{$key});
print "\n";
}
I would appreciate any help that you can offer.
Thanks,
Todd
I am trying to write all of my code using strict to improve my
code. However, the correct use of references for the following problem
eludes me. I have a work around, but I would like to know the correct
way to code this.
#!/usr/bin/perl -w
######################################
use strict;
#no strict 'refs'; ## work around ##
######################################
my %hash = qw(foo one bar two);
my $key;
foreach $key (keys %hash)
{
@{$key} = (0..5);
}
######################################
# later on in the program
######################################
foreach $key (keys %hash)
{
print "array $hash{$key} = ";
print join("\t",@{$key});
print "\n";
}
I would appreciate any help that you can offer.
Thanks,
Todd