Thread Probleme mit File::Find (12 answers)
Opened by Lebewesen at 2012-05-08 16:35

topeg
 2012-05-08 18:27
#158228 #158228
User since
2006-07-10
2611 articles
BenutzerIn

user image
Logickfehler.

$i++ erhöht den Wert wenn du danach "$dir/$i" machst ist das der erhöhte wert.

was du willst:
Code (perl): (dl )
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
#!/usr/bin/perl
use 5.008;
use strict;
use warnings;
use File::Find;

my $dir = '.';
my @found = ();


my $i=2005;
while (1){
  my $path="$dir/$i";

  last unless(-d $path);

  print "$path\n";
  $i++;

  find({preprocess => sub { return sort @_ }, wanted => sub {if ($File::Find::name =~ /\d_12.*/){push @found, $File::Find::name;}}},  $path);
}

my $anzahl=@found;
#print @found;
print "\n\nAnzahl: $anzahl\n";

View full thread Probleme mit File::Find