#!/usr/bin/perl # Ouverture des fichiers en lecture et écriture open(IN,"<$ARGV[0]"); open(OUT,">:encoding(utf8)","$ARGV[0].html"); my $nomfichier; if ($ARGV[0] =~ /^(.+?).pl$/) { $nomfichier = $1; } print OUT '
'; my $dump = ""; while (my $ligne =) { $ligne =~ s/&/&/g; $ligne =~ s/</g; $ligne =~ s/>/>/g; unless ($ligne =~ /\$\#\w+/) { $ligne =~ s/^(.*?)(\#.+)$/$1$2<\/i>/g; } $ligne =~ s/\b(sub|if|else|elsif|for|foreach|my|while|unless|chomp|open|close|until|print|exit|closedir|opendir|sort|system|exists|readdir|shift|use|push|die|next|split|unshift|join|each|map|keys|not|delete)\b/$1<\/span>/g; $ligne =~ s/(\$\w+)/$1<\/span>/g; $ligne =~ s/(\$\#\w+)/$1<\/span>/g; $ligne =~ s/(@\w+)/$1<\/span>/g; $ligne =~ s/(@)\{/$1<\/span>\{/g; $ligne =~ s/(@)()(\$\w+)/$1$3/g; $ligne =~ s/(%\w+)/$1<\/span>/g; $dump .= $ligne; } print OUT $dump; print OUT '