Yes. If you replace the commented out code inside the for loop with this:
And then Dump out %hash then you will see that it contains the keys and values that you require. However ... there are much better ways to construct the hash that you want, such as:$hash{$var_p} = $var;
use strict; use warnings; use Data::Dumper; my @keys = (1 .. 6); my @values = map $_ + 3, 0 .. $#keys; my %hash; @hash{@keys} = @values; print Dumper \%hash;
Hope this helps!
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
In reply to Re: Filling a hash in loop
by jeffa
in thread Filling a hash in loop
by CropCircle
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |