>>>>> "John" == John W Krahn <[EMAIL PROTECTED]> writes:
John> James Edward Gray II wrote: >> >> Is there a simple way, like a one liner perhaps, that will give me the >> octal/hex value of a character? I need to look certain characters up, >> so I would like to be able to give it something like an 'a' or even >> "\n" and have it answer 141 or 012 (assuming UNIX). Thanks for your >> time. John> my $oct = sprintf '%o', $num; John> my $hex = sprintf '%x', $num Not quite. You're missing the step that converts 'a' to 97 decimal so that the '%o' can work: my $oct_string = sprintf '%03o', ord($character); -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 <[EMAIL PROTECTED]> <URL:http://www.stonehenge.com/merlyn/> Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]