how to write a "od -bc" like function?



hi all
Could any one give me a direction to write a function to match the unix-like
function "od -bc" do.
Now I only get the idea of opening the file.

open(IN, "filename")or die;
my $str=<IN>;
..............
close(IN);

By the way, if the file is a exe or image type, the $str seems don't work
correctly.



.