title: Is there an elegant zip to interleave two lists in Perl 5?
body: <p>I recently "needed" a zip function in Perl 5 (while I was thinking about <a href="https://stackoverflow.com/questions/11/how-do-i-calculate-relative-time">How do I calculate relative time?</a>), i.e. a function that takes two lists and "zips" them together to one list, interleaving the elements.</p>
  
  <p>(Pseudo)example: </p>
  
  <pre><code>@a=(1, 2, 3);
  @b=('apple', 'orange', 'grape');
  zip @a, @b; # (1, 'apple', 2, 'orange', 3, 'grape');
  </code></pre>
  
  <p><a href="http://www.haskell.org/onlinereport/standard-prelude.html" rel="nofollow noreferrer">Haskell has zip in the Prelude</a> and <a href="http://ferreira.nfshost.com/perl6/zip.html" rel="nofollow noreferrer">Perl 6 has a zip operator</a> built in, but how do you do it in an elegant way in Perl 5?</p>