in reply to How can I count the number and kinds of letters at 1st, 2nd and 3rd positions of 3-letter words in a string?
(untested)my ($i,%x); $i=0; $x{$_}[$i++%3]++ for split //, $a; for my $k (sort keys %x){ my $aref = $x{$k}; print "$k "; print for @$aref; print $_; }
All great truths begin as blasphemies.
― George Bernard Shaw, writer, Nobel laureate (1856-1950)
|
|---|