On Wed, 31 Jul 2002 18:17:46 +0800, [EMAIL PROTECTED] (Connie Chan)
wrote:
>> Does anyone know or can point me to a
>> location where I can find the chr() value of this character? All replies are
>> greatly appreciated.

>my @chars = split //, $line; # $line is your string.
>foreach my $char(@chars) { print sprintf"%1x", ord($char) ; print " " }
># Hope this help.

Hi, this dosn't match up the ascii character with the hex code, making
it very hard to read the output. Here is an improved version, which
prints out the hex characters vertically, directly beneath each
character. Add this to your utilities directory.
#ascii-hex-print
###########################################################
#!/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 [EMAIL PROTECTED] 6 July 2001
# Version 1.10 James Yolkowski [EMAIL PROTECTED] 8 July 2001

print;                          
@hexvals = map {sprintf "%02X", ord $_} split //;  
for $a (0, 1) {print map {substr $_, $a, 1} @hexvals}
#############################################################



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to