use strict; use warnings; my $data = <) { ++$hits{$_} for split ''; } print "$_: $hits{$_}\n" for ',', '.', '[', ']', '-';