in reply to Two arrays. One hash.
Just be careful to avoid this sort of situation:
my @keyset = qw/this repeat that repeat/ my @valset = qw/jerry george elaine kramer/; my %hash; @hash{@keyset} = @valset; print "$_: $hash{$_}\n" foreach keys %hash; __OUTPUT__ that: elaine this: jerry repeat: kramer
For nonunique keys, only the last item assigned to a given nonunique key will be preserved. Poor 'george' was discarded.
Dave
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Two arrays. One hash.
by Roger (Parson) on Nov 29, 2003 at 23:47 UTC | |
by jeffa (Bishop) on Nov 30, 2003 at 15:46 UTC |