use warnings; use strict; my $file_r = $ARGV[0]; my $file_r = $ARGV[1]; open FILE_R, "< $file_r" or die "Can't open $file_r : $!"; open FILE_P, "< $file_p" or die "Can't open $file_p : $!"; my @rdata; my @pdata; #these two are of the same size while (){ chomp; push @rdata, $_; } while (){ chomp; push @pdata, $_; } my @sum = map {$rdata[$_] + $pdata[$_]} 0..$#pdata; print "$file_r\n"; print ">\n"; foreach my $sum (@sum){ print "$sum\n"; }