title: How can I print an array in chunks with a delimeter as the last character of the line in all but the last line
body: <p>I have the following:  </p>
  
  <pre><code>my @array = qw/a b c d e f g h i j/;  
  my $elements_per_line =4;
  </code></pre>
  
  <p>I need the output to look like this:</p>
  
  <pre><code>a | b | c | d |
  e | f | g | h |
  i | j 
  </code></pre>
  
  <p>I have tried this: </p>
  
  <pre><code>while (@array) { 
      print join " | ", splice(@array, 0, $elements_per_line), "\n";
  }
  </code></pre>
  
  <p>But that results in the " | " at the end of all 3 lines.</p>