#!/usr/bin/perl -w use strict; my $infile = $ARGV[0]; open INPUT, "<", $infile or die "Couldn't open '$infile' : $!"; my $input = do { local $/; }; my %histogram; for my $char (split //, $input) { $histogram{$char}++; }; for (keys %histogram) { print "$_ occurred $histogram{$_} times.\n"; };