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
|
use HTML::Entities;
$rep="$ARGV[0]";
# On s'assure que le nom du répertoire ne se termine pas par un / ou un \
$rep=~ s/[\/]$//;
# On initialise une variable contenant le flux de sortie qui sera enregistré dans un fichier
$resultat="";
# Fichier contenant le flux de sortie
$output="sortie.html";
if (!open (SORTIR,">$output")) { die "Pb à l'ouverture du fichier $output"};
# Exécution de la procédure motcle
&motcle($rep);
# le contenu du fichier de sortie
print SORTIR "<html>\n";
print SORTIR "<head>\n";
print SORTIR "<META http-equiv=\"content-Type\" content=\"text/html; charset=UTF-8\" />\n";
print SORTIR "<title>\n Perl "</title>\n";
print SORTIR "</head>\n";
print SORTIR "<body><center>\n<h2>Mots Clés</h2>\n<table border=\"1\">\n<tr><th>MOTS CLES</th><th>LIEN</th></tr>".$resultat."\n";
print SORTIR "</table>\n</center>\n</body>\n</html>\n";
close (SORTIR);
exit;
foreach $motcle (sort keys %motscles){
$resultat.="<tr><td align=\"center\">$motcle</td><td>";
@fichiers=split(/,/, $motscles{$motcle});
foreach $fichier(@fichiers)
{$resultat.="<a href=\"$fichier\">$fichier</a><br/>\n"}
$resultat.="</td></tr>\n";
} |
Partager