<?xml version="1.0" encoding="windows-1252"?>
<node id="966314" title="Re^2: how to print two array with new line at end of each second array element, using a single print statement?" created="2012-04-21 02:48:32" updated="2012-04-21 02:48:32">
<type id="11">
note</type>
<author id="281137">
davido</author>
<data>
<field name="doctext">
&lt;p&gt;I was just about to follow up with that [cpan://List::MoreUtils|pairwise] option.  Glad I saw your update before I did.  But I still wanted to mention that I find it necessary to write it something like this:&lt;/p&gt;
&lt;c&gt;
print pairwise{ no warnings 'once'; "$a $b\n" } @nums, @dat;
&lt;/c&gt;
&lt;p&gt;...lest I get a pair of warnings that &lt;c&gt;$a&lt;/c&gt; and &lt;c&gt;$b&lt;/c&gt; are used only once.&lt;/p&gt;
&lt;p&gt;[cpan://List::MoreUtils] provides several ways to do it.  This isn't quite as elegant, but still seemed neat to me.&lt;/p&gt;
&lt;c&gt;
my $ea = each_array( @nums, @dat );
while( my( $n, $d ) = $ea-&gt;() ) {
    print "$n $d\n";
}
&lt;/c&gt;
&lt;p&gt;&lt;b&gt;Update:&lt;/b&gt; I've submitted a patch and a corresponding test targeting the 'used only once' warnings.&lt;/p&gt;
&lt;div class="pmsig"&gt;&lt;div class="pmsig-281137"&gt;
&lt;br /&gt;&lt;p&gt;Dave&lt;/p&gt;
&lt;/div&gt;&lt;/div&gt;</field>
<field name="root_node">
966310</field>
<field name="parent_node">
966313</field>
</data>
</node>
