PerlingTheUK has asked for the wisdom of the Perl Monks concerning the following question:
but should have done%locations = map{ $_ => 1 } ( @locations );
Now I think that this setup is really annoying, easpecially as I would like rewrite it so that every value is counted to represent how often a location has been added. Is there a way to add onto the old hash instead of completely rewriting it?%locations = map{ $_ => 1 } ( @locations, keys %locations );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Adding values from an array to a hash
by davorg (Chancellor) on Oct 12, 2006 at 10:10 UTC | |
|
Re: Adding values from an array to a hash
by blazar (Canon) on Oct 12, 2006 at 10:29 UTC | |
|
Re: Adding values from an array to a hash
by reneeb (Chaplain) on Oct 12, 2006 at 11:27 UTC |