Hmm. It occurs to me that if the goal's to do it in a single statement, it can be done quite easily:
#!/usr/bin/perl use strict; use warnings; my @k = qw( a b c a b a ); my %i = do { my %h; map { $_ => ++$h{$_} } @k }; print join " ", %i;
That's cheating of course, but so is tie. :-)
Makeshifts last the longest.
In reply to Re^3: How can I populate a hash?
by Aristotle
in thread How can I populate a hash?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |