Bonjour,

Je voudrais savoir comment je peux passer à un autre fichier dans une boucle if dans laquelle je demande de match un string si ce string est match il m'affiche un message sinon il passe à un autre fichier et ainsi de suite.

voici mon code:

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
my $word = "diffusion restreinte";
my @s = GetFilesList (cwd);
my $FilesListLength = @s;
 
	for(my $j = 0; $j <= $FilesListLength; $j++) {		
	next if(!defined $s[$j]);
 
		if($s[$j] =~ /.*\.pdf/) {
 
			my $pdf = CAM:: PDF->new($s[$j]);		
			for (my $i=1;$i<=$pdf->numPages();$i++) {
 
				my @pageNow = $pdf->getPageText($i);
				next if (!@pageNow);
 
					foreach my $file (@pageNow){
						if($file =~ m/$word/) {
 
						print $s[$j]."------> contient $word\n";
 
						}
 
					}
			}
		}
	}

merci