in reply to How can I populate a hash?
You can't do that without an explicit loop. It's the nature of hash assignments. The right-hand list is only evaluated once, with competing keys successively overwriting each other on assignment, so it's not possible to do such a calculation.
As an aside, Perl6 hyperops would allow this. The closest Perl5 gets is
++$_ for @count{ @a };
Makeshifts last the longest.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How can I populate a hash?
by chromatic (Archbishop) on Jan 26, 2005 at 00:24 UTC | |
by Aristotle (Chancellor) on Jan 26, 2005 at 02:25 UTC |