title: How can I convert hex strings into numbers in Perl?
body: <p>I recently wrote a script which parsed a text representation of a single binary byte month field. </p>
  
  <p>(Don't ask :-{ ) </p>
  
  <p>After fiddling with sprintf for a while I gave up and did this;</p>
  
  <pre><code>our %months = qw / x01 1 
         x02 2
         x03 3 
         x04 4 
         x05 5 
         x06 6 
         x07 7 
         x08 8 
         x09 9 
         x0a 10 
         x0b 11 
         x0c 12 /;
  ...
  my $month = $months{$text};
  </code></pre>
  
  <p>Which I get away with, because I'm only using 12 numbers, but is there a better way of doing this?</p>