in reply to Assigning values to undef hash reference keys two or more at a time
perlreftut says "Whatever you want to do with a reference, Use Rule 1 tells you how to do it. You just write the Perl code that you would have written for doing the same thing to a regular array or hash, and then replace the array or hash name with {$reference} ."
My traditional hash gets the values assigned to keys with this:
So I thought some form of this would work but I can't get it right.my @values = ("value1", "value2", "value3"); @employees{qw(key1 key2 key3)} = @values;
I've tried many more combinations, including moving the brackets all over the place. Is this even close? I need a bigger hint I guess.@{$hashref->{qw/key1 key2 key3/}} = @values; %{$hashref}->{qw/key1 key2 key3/} = @values;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Assigning values to undef hash reference keys two or more at a time
by JadeNB (Chaplain) on Oct 23, 2008 at 20:29 UTC |