Bonjour,
Je construis un script pour parser des fichiers et, en fonction du test de pattern, mettre les résultats dans un tableau.
Voici pour l'instant ce que j'ai fais
Le script génère bien le code html mais comment générer un fichier html pour qu'ensuite on puisse l'envoyer? Je bloque sur ce point.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 #!/usr/bin/perl use strict; use warnings; use utf8; use open ':encoding(utf8)'; binmode(STDOUT, ":utf8"); my $DateLog = localtime(); print "===>Date : $DateLog\n"; #my $contacts = '#'; my $file = $ARGV[0]; open(my $fh, '<:encoding(utf8)', $file) or die "Can't open '$file' $!"; my $html = "rapport.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>"; } } print $html;
Merci d'avance pour votre aide.
Cordialement,
Partager