Ajout deuxième partie

This commit is contained in:
rick 2021-06-04 10:55:59 +02:00
parent 2ea70eaa93
commit 33bdce126d
Signed by: Rick
GPG key ID: 2B593F087240EE99

View file

@ -1,3 +1,4 @@
#!usr/bin/perl
use strict; use strict;
use warnings; use warnings;
@ -15,6 +16,19 @@ while (<FH>) {
$total = $total + length($_) - length($tmp); $total = $total + length($_) - length($tmp);
} }
close(FH); print "Le total est : $total.\n";
seek FH, 0, 0;
$total = 0;
print "Traitement de la deuxième partie…\n";
while (<FH>) {
$tmp = $_;
$tmp =~ s/\\/\\\\/ig;
$tmp =~ s/"/\\"/ig;
chomp($tmp);
chomp($_);
$total = $total + length($tmp) + 2 - length($_);
}
print "Le total est : $total.\n"; print "Le total est : $total.\n";
close(FH);