1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
| #!/usr/bin/perl
use strict;
use warnings;
open my $infile, '<', 'test.txt' or die $!;
open my $outfile, '>', 'output.txt' or die $!;
my $last_line;
while (my $line = <$infile>){
if ($. == 1){
$last_line = $line;
next;
}
else{
my ($mot1, $mot2, $mot3, $mot4, $mot5, $mot6);
if ( $last_line =~ m/^(([^,]+),([^.]+)\.n\+py.+)/){
$mot1 = $1;
$mot2 = $2;
$mot3 = $3;
}
if ( $ligne =~ m/^(([^,]+),([^.]+)\.ng\+py.+)/){
$mot4 = $1;
$mot5 = $2;
$mot6 = $3;
}
if ($mot2 eq $mot5){
print $outfile ...;
}
}
}
close $infile;
close $outfile; |
Partager