Without comments is more clear :)
======================================
#!/usr/bin/perl -w
use strict;
use 5.010;

open FILE, '<', "numbers.txt" or die "can not open file . $!\n";
open FILE1, '>>', "sumfile.txt" or die "can not open file . $!\n";
select FILE1; # set the defualt output stream

chomp (my @lines = <FILE>);
my (@ln, $first, $second);

foreach (@lines) { @ln = split /\h/, $_;  
                    $first .= (shift @ln)." ";
                    $second .= (pop @ln)." ";
}

print "$first \n$second";

close FILE;
close FILE1;
========================================

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to