You can be inspired by one of the many implementations of hexdump in perl, e.g. this one (Note that is uses neither strict nor warnings, so a good exercise could be to improve it).
--
No matter how great and destructive your problems may seem now, remember, you've probably only seen the tip of them. [1]