Reputation: 5
I have some mistakes in my code. This code works locally but not on my server.
#Vérification de la concordance BD -> Sons
for (my $k = 0; $k < scalar(@tableau_de_donnees); $k++) {
my $donnee = $tableau_de_donnees[$k];
if ($donnee) {
my @une_donnee = split(/\./, $donnee); #enlève l'extension
for (my $l = 0; $l < scalar(@tableau_de_sons); $l++) {
my $son = $tableau_de_donnees[$l];
my @un_son = split(/\./, $son); #enlève l'extension
if ($une_donnee[0] eq ($un_son[0])) {
$trouver_son = "1";
}
}
if ($trouver_son == "0") {
print "Le fichier "
. $tableau_de_donnees[$k]
. " est introuvable. \n";
}
$trouver_son = "0";
} else {
print "Fin";
}
}
Here is the log:
Use of uninitialized value in string eq at verif_db_physio.pl line 141, line 2.
Use of uninitialized value $son in split at verif_db_physio.pl line 139, line 2.
Upvotes: 0
Views: 255
Reputation: 98398
It looks to me like this:
my $son = $tableau_de_donnees[$l];
should be this::
my $son = $tableau_de_sons[$l];
You could avoid the problem entirely by changing
for (my $l = 0; $l < scalar(@tableau_de_sons); $l++) {
my $son = $tableau_de_donnees[$l];
to
for my $son (@tableau_de_sons) {
Upvotes: 3