in reply to Need a little help appending lines

I'm going to simplify your input parsing as I think it's a bit confusing. But one way of appending output is:

#!/usr/bin/perl use warnings; use strict; my $file = "outtest.txt"; open OUT, ">>", $file || die("Cannot open file for output.\n"); my @array; while(<DATA>) { s/tcp//g; @array = split(/\s+/, $_); print OUT "Address1=",$array[1],"\n"; print OUT "Address2=",$array[2],"\n"; print OUT "Address3=",$array[3],"\n"; } __DATA__ tcp 20 tcp 40 tcp 80
And the output is:

<code> C:\Code>perl C:\Code>perl C:\Code>type outtest.txt Address1=20 Address2=40 Address3=80 Address1=20 Address2=40 Address3=80