title: Perl parse String with one or more fields
body: <p>I have a string I need to parse.  It meets the following requirements:</p>
  
  <ul>
  <li>It is comprised of 0 or more key->value pairs.  </li>
  <li>The key is always 2 letters.  </li>
  <li>The value is one or more numbers.   </li>
  <li>There will not be a space between the key and value.  </li>
  <li>There may or may not be a space between individual pairs. </li>
  </ul>
  
  <p>Example strings I may see:</p>
  
  <ul>
  <li>AB1234    //One key->value pair  (Key=AB,  Value=1234)</li>
  <li>AB1234 BC2345  //Two key->value pairs, separated by space</li>
  <li>AB1234BC2345   //Two key->value pairs, not separated by space</li>
  <li>//Empty Sting, No key->value pairs</li>
  <li>AB12345601BC1234CD1232PE2343  //Lots of key->value pairs, no space</li>
  <li>AB12345601 BC1234 CD1232 PE2343  //Lots of key->value pairs, with spaces</li>
  </ul>
  
  <p>I need to build a Perl hash of this string. If I could guarantee it was 1 pair I would do something like this:</p>
  
  <pre><code>$string =~ /([A-Z][A-Z])([0-9]+)/
  $key = $1
  $value = $2
  $hash{$key} = $value
  </code></pre>
  
  <p>For multiple strings, I could potentially do something where after each match of the above regex, I take a substring of the original string (exempting the first match) and then search again.   However, I'm sure there's a more clever, perl-esque way to achieve this.</p>
  
  <p>Wishing I didn't have such a crappy data source to deal with-</p>
  
  <p>Jonathan</p>