<?xml version="1.0" encoding="windows-1252"?>
<node id="992399" title="Re: Scalar function" created="2012-09-07 18:45:36" updated="2012-09-07 18:45:36">
<type id="11">
note</type>
<author id="401112">
johngg</author>
<data>
<field name="doctext">
&lt;p&gt;As [MidLifeXis] [id://992351|points out], you need to [doc://chomp] your newlines.&lt;/p&gt;
&lt;code&gt;
$ perl -E '
&gt; open my $fa, q{&lt;}, \ &lt;&lt;EOF1 or die $!;
&gt; file A line 1
&gt; file A line 2
&gt; EOF1
&gt; 
&gt; open my $fb, q{&lt;}, \ &lt;&lt;EOF2 or die $!;
&gt; file B line 1
&gt; file B line 2
&gt; EOF2
&gt; 
&gt; say join q{,},
&gt;    map { chomp; $_ } scalar &lt;$fa&gt;, scalar &lt;$fb&gt;;'
file A line 1,file B line 1
$
&lt;/code&gt;
&lt;p&gt;I hope this is helpful.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Update: &lt;/b&gt;A more complete example putting the &lt;c&gt;$fa&lt;/c&gt;, &lt;c&gt;$fb&lt;/c&gt; and &lt;c&gt;$fc&lt;/c&gt; filehandles in an array and showing how you might cope if they contain fewer lines than &lt;c&gt;$fi&lt;/c&gt; using [doc://eof].&lt;/p&gt;
&lt;code&gt;
$ perl -Mstrict -Mwarnings -E '
&gt; open my $fi, q{&lt;}, \ &lt;&lt;EOFi or die $!;
&gt; File I Line 1
&gt; File I Line 2
&gt; File I line 3
&gt; EOFi
&gt; 
&gt; open my $fa, q{&lt;}, \ &lt;&lt;EOFa or die $!;
&gt; File A Line 1
&gt; File A Line 2
&gt; EOFa
&gt; 
&gt; open my $fb, q{&lt;}, \ &lt;&lt;EOFb or die $!;
&gt; File B Line 1
&gt; File B Line 2
&gt; File B Line 3
&gt; EOFb
&gt; 
&gt; open my $fc, q{&lt;}, \ &lt;&lt;EOFc or die $!;
&gt; File C Line 1
&gt; File C Line 2
&gt; File C Line 3
&gt; File C Line 4
&gt; EOFc
&gt; 
&gt; my @slaveFHs = ( $fa, $fb, $fc );
&gt; while ( &lt;$fi&gt; )
&gt; {
&gt;     chomp;
&gt;     say join q{,}, $_,
&gt;        map { chomp; $_ }
&gt;        map { eof $_ ? q{--eof--} : scalar &lt;$_&gt; }
&gt;        @slaveFHs;
&gt; }'
File I Line 1,File A Line 1,File B Line 1,File C Line 1
File I Line 2,File A Line 2,File B Line 2,File C Line 2
File I line 3,--eof--,File B Line 3,File C Line 3
&lt;/code&gt;
&lt;!-- Node text goes above. Div tags should contain sig only --&gt;
&lt;div class="pmsig"&gt;&lt;div class="pmsig-401112"&gt;
&lt;p&gt;Cheers,&lt;/p&gt;&lt;p&gt;JohnGG&lt;/p&gt;
&lt;/div&gt;&lt;/div&gt;</field>
<field name="root_node">
992345</field>
<field name="parent_node">
992345</field>
</data>
</node>
