#!/usr/bin/perl use strict; my @ch; while (<>) { $ch[ord()]++ for ( split( // )); } printf "%6d %.2x\n", $ch[$_], $_ for ( grep {$ch[$_]} 0..$#ch );