Thread hex to decimal conversion
(12 answers)
Opened by thegreatonech at 2010-06-10 15:05 Guest thegreatonech Why on earth do you store your data in a hash instead of an array if your keys are consecutive integers? Anyhow, you can do something like this: Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 use 5.012; my %hash = ( 0 => 'aa', 1 => 'bb', ... ); my $count = 512; my $_; for (0 .. ($count / 2)) { my $i = 2 * $_; say hex($hash{$i} . $hash{$i + 1}); } (code untested) When C++ is your hammer, every problem looks like your thumb.
|