title: perl - split string into 2-character groups
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/372370/how-can-i-split-a-string-into-chunks-of-two-characters-each-in-perl">How can I split a string into chunks of two characters each in Perl?</a>  </p>
  </blockquote>
  
  
  
  <p>I wanted to split a string into an array grouping it by 2-character pieces:</p>
  
  <pre><code>  $input = "DEADBEEF";
    @output = split(/(..)/,$input);
  </code></pre>
  
  <p>This approach produces every other element empty.</p>
  
  <pre><code>  $VAR1 = '';
    $VAR2 = 'DE';
    $VAR3 = '';
    $VAR4 = 'AD';
    $VAR5 = '';
    $VAR6 = 'BE';
    $VAR7 = '';
    $VAR8 = 'EF';
  </code></pre>
  
  <p>How to get a continuous array?</p>
  
  <pre><code>  $VAR1 = 'DE';
    $VAR2 = 'AD';
    $VAR3 = 'BE';
    $VAR4 = 'EF';
  </code></pre>
  
  <p>(...other than getting the first result and removing every other row...)</p>