in reply to creates anonymous hashes with hash slices
Of course, you can switch qw(one two three four) with @list_of_keys or (1..6)my $rhash; for my $key (qw(one two three four)) { $rhash->{$key} = $parm{$key}; }
Which was wrong because that expression returns a list of values corresponding to those keys, while what you want is a list of keys.for my $key (@parm{one,two,three,four)}) {
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: Re: creates anonymous hashes with hash slices
by merlyn (Sage) on Aug 03, 2000 at 21:15 UTC |