Because I just couldn't resist:
perl -le'$/=\1024; while(<>){ $x[$_]++ for split//}' /path/to/pi
Note that I set $/ to a reference to 1024, which causes the
<> operator to read chunks of 1024 characters at a time. Also note that I used an array to store the values in stead of a hash, with a total of 9 digits, an array should be faster and more space efficient.
Update: as
frodo72 pointed out, it was indeed missing a closing curly bracket. Fixed.