in reply to Re: printing hexadecimal without printf
in thread printing hexadecimal without printf
You code does spit out the appropriate decimal values...
updateFollowing up on (well, preceding up on ???) toolic's suggestion with an example using pack/unpack:
for (my $i = 1; $i <= 20; $i++) { $a+=0x0C; $out = pack "c", $a; $hex = unpack "H2", $out; print "\t$i Now, \$a (as decimal) is:\t$a \tand as hex: 0x$hex\n"; }
And if this is indeed homework, the implicit suggestion of Fletch's comment may be "FGS, at least label it as such."
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: printing hexadecimal without printf
by tpais (Novice) on Nov 28, 2007 at 11:41 UTC |