If you don't want it to loop endlessly then remove the 'while' loop I showed you to remove.
---------- Post updated at 02:25 PM ---------- Previous update was at 02:15 PM ----------
Maybe this is w2hat you want to do:
Code:
#!/usr/local/bin/perl
use warnings;
use strict;
die "Usage: $0 <file1> <file2> <file_out>\n" unless $#ARGV==2;
my ($file1, $file2, $file3) = @ARGV;
open my $f1_in, $file1 or die "Could not open $file1\n";
open my $f2_in, $file2 or die "Could not open $file2\n";
open(my $f3_out, '>', $file3) or die "Could not open $file3: $!\n";
while (my $f1 = <$f1_in>) {
my $f2 = <$f2_in>;
$f1 =~ s/^\s+|\s+$//g;
$f2 =~ s/^\s+|\s+$//g;
my($Fld0,$Fld1,$Fld2,$Fld3,$Fld4,$Fld5,$Fld6,$Fld7,$Fld8,$Fld9,$Fld10) = split(/\|/,$f2, -1);
print $f3_out join(',',$Fld0, $Fld1, $Fld2, $Fld3, $Fld4, $Fld10);
}