looking for a program

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: sinck@ugive.com
Date:  
Subject: looking for a program

\_ 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?