just to reiterate on damn cool features ...<br><br>#!/opt/perlbleed/bin/perl<br><br>use strict;<br>use warnings;<br><br>use feature ":5.10";<br><br>my $isuniq = \&isuniq;<br><br>while(<>)<br>{<br> given ($_)
<br> {<br> when ( /^(\S.*)$/ ) { say "you said $1 ",$isuniq->($1)," times" }<br> default { say "you said nothing ",$isuniq->(qq{nothing})," times" }<br> }<br>
}<br><br>sub isuniq<br>{<br> state %count;<br> return ++$count{$_}{'count'};<br>}<br clear="all"><br><br>-- <br>The optimist thinks that this is the best of all possible worlds,<br>and the pessimist knows it.
<br> -- J. Robert Oppenheimer, "Bulletin of Atomic Scientists"