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
| #!/usr/bin/perl
use warnings;
use strict;
use POSIX qw(mktime strftime);
my $nom_fichier = "/jeff/resultat.dat";
my $day;
my $month;
my $year;
my $min;
my $ligne;
my @default_line = ("////", "////", "////");
open(FIC,"$nom_fichier") or die "Ce fichier $nom_fichier n'a pu être ouvert : $!\n";;
my @fic = <FIC> ;
foreach $ligne (@fic) {
&next_mn()
}
sub next_mn {
my $current_mn = @_;
my ($day, $month, $year, $hour, $min) = $current_mn =~ /(\d\d)(\d\d)(\d\d\d\d)(\d\d)(\d\d)/;
return strftime("%d%m%Y%H%M", 0, $min + 10, $hour, $day, $month - 1, $year - 1900);
my $expected_mn;
while (<FIC>) {
my ($mn) = split /;/;
while (defined $expected_mn && $expected_mn != $mn) {
print join ";", $expected_mn, @default_line, "\n";
$expected_mn = next_mn($expected_mn);
}
print;
$expected_mn = next_mn($mn);
}
}
close(FIC); |
Partager