in reply to Perl/TK hex2char - char2hex convertor

In all of these hex-char converters, there is the problem of eye-strain trying to match up the 1 to 1 relationship between the chars and the hex values. (Let's see did I count over 10 chars or was that 11, etc). It's better to display the chars and hex values together, so you can see the match at a glance. Below is some code which does that. If you could do that with your tk script, it would be a great app.
#!/usr/bin/perl -wnl012 # Prints the contents of a file a line at a time # followed by the ASCII value of each character in vertical columns. # Useful for debugging. # If no filename is specified then input is read from the keyboard. # Version 1.00 Ian Howlett ian@ian-howlett.com 6 July 2001 # Version 1.10 James Yolkowski ajy@sentex.net 8 July 2001 print; # Print the line we've just read @hexvals = map {sprintf "%02X", ord $_} split //; # Get hex value of e +ach char for $a (0, 1) {print map {substr $_, $a, 1} @hexvals} # Print the hex +values. #print "\n";

Janitored by Arunbear - removed pre tags to improve readability