#!/usr/bin/perl use strict; use warnings; use diagnostics; use Cwd; my $Current_Dir = getcwd; print STDOUT "the current directory is $Current_Dir\n"; my $file_1 = "$ARGV[0]"; my $file_2 = "$ARGV[1]"; ################### OPEN THE FIRST INFILE ############################ open(INFILE_1,"<$file_1") or die "Can't open $file_1 : $!"; ################################################################# ################### OPEN THE OUTFILE ############################ my $outfile = "outfile_$file_1"; open(OUTFILE,">$outfile") or die "Can't open $outfile : $!"; ################################################################## # print the title of the columns my $titles_line = ; print OUTFILE "$titles_line"; while (my $line_1 = ){ chomp($line_1); my @Elements_1 = split(/;/, $line_1); my $aircraft_id_1 = $Elements_1[1]; # print STDOUT "the aircraft_id in the Analysis_slot_list is : $aircraft_id_1\n"; # calculation of the length of $line_1 my $length_1 = @Elements_1; print STDOUT "the length is $length_1\n"; print STDOUT "The Table is @Elements_1\n"; print OUTFILE "$line_1"; my $meter = $length_1; if (defined $aircraft_id_1){ ################### OPEN THE SECOND INFILE ############################ open(INFILE_2,"<${file_2}") or die "Can't open ${file_2} : $!"; ################################################################# while (my $line_2 = ){ chomp($line_2); my @Elements_2 = split(/;/, $line_2); # warning : in this file, the aircraft_id looked for is in the first column my $aircraft_id_2 = $Elements_2[0]; # print STDOUT "the aircraft_id in the resemblance_criterion_file is : $aircraft_id_2\n"; if ($aircraft_id_1 eq $aircraft_id_2){ print OUTFILE ";$line_2\n"; } } close INFILE_2; } else{ while ($meter<40){ print OUTFILE ";"; ++ $meter; } } } close INFILE_1; close OUTFILE;