in reply to Re^4: Two Column Data
in thread Two Column Data
Note that you have a slight discrepancy between the header and the data: your code for the header uses three "|" symbols, but the output result that you are looking for does not. I'll leave it to you to sort out what you really want, but feel free to ask if you encounter any difficulty, or if you don't understand something from the above code. Also note that this is untested, as I have not real test data.print "=====================================\n"); print "| INBOUND TRACK 1 | INBOUND TRACK 2 |\n"); print "=====================================\n"); open my $IN1, "<", "inbndtrk1.txt" or die "could not open inbndtrk1.tx +t" ; open my $IN2, "<", "inbndtrk2.txt" or die "could not open inbndtrk2.tx +t" ; while (my $in1 = <$IN1>) { chomp $in1; $in1 = s/:/ /; my $in2 = <$IN2>; $in2 = s/:/ /; print "$in1|$in2"; }
Update: Oops, stupid error on my part, thanks to AnomalousMonk for pointing out. The loop code should be:
while (my $in1 = <$IN1>) { chomp $in1; $in1 =~ s/:/ /; my $in2 = <$IN2>; $in2 =~ s/:/ /; print "$in1|$in2"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Two Column Data
by PilotinControl (Pilgrim) on May 11, 2015 at 22:42 UTC | |
by AnomalousMonk (Archbishop) on May 11, 2015 at 22:59 UTC |