1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| open(my $fh, '<:encoding(UTF-8)', $file) or die "Can't open '$file' $!";
open(my $fho, '>:encoding(UTF-8)', 'rapport.html') or die "Can't open 'rapport.html' $!";
my $html = "";
#parsing des fichiers et creation du tableau de synthese
while (my $row = <$fh>) {
chomp $row;
if ($row =~ "^77") {
$html .= "<html><head></head><body><table><tr>";
my @arr = split / /, $row;
foreach my $item (@arr) {
$html .= "<td>" . $item . "</td>";
}
$html .= "</tr></table></body></html>";
# J'imagine qu'à ce stade tu peux sortir de la boucle while
}
}
print $fho $html;
# ne pas oublier de fermer les fichiers
close $fh;
close $fho; |
Partager