#!/usr/bin/perl use strict; use warnings; die "Usage: $0 file.name\n" unless ( @ARGV == 1 and -f $ARGV[0] ); open( FH, shift ); binmode FH; $/ = undef; $_ = ; my %char_hist; for my $c ( split // ) { $char_hist{ sprintf( "%02x", ord( $c )) }++; } for my $c ( sort keys %char_hist ) { printf "%s\t%d\n", $c, $char_hist{$c}; }