looking for a program
sinck@ugive.com
sinck@ugive.com
Tue, 6 Feb 2001 22:08:20 -0700
\_ I'm looking for a program that will take either a decimal, hex or octal
\_ input and give me its decimal, hex or octal output. Can anyone tell me what
\_ I'm looking for?
\_
<BOFH>
perl? Bah. Use that on big numbers. For small numbers, RTFM.
</BOFH>
In particular, 'man ascii' and pick the conversion you want. You'll
also get the popular %c conversion as well, all in a nice tabular
format.
:-)
David
OB perl variant:
--snip--
#!/usr/bin/perl
my $arg = shift;
eval "\$i = $arg;";
printf "%s is one of: 0%o or %dd or 0x%X\n", $arg, map {$i} 0 .. 2;
# who said map wasn't useful?