mein code schaut nun so aus
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/opt/perl5.8.6/bin/perl -w
use strict;
use Time::Local;
use Data::Dumper;
my $dir = "/pfad/";
my $oldname = 0;
my @info = ();
my %dif_hash = ();
opendir(DIR, "$dir");
#@files = readdir(DIR);
my @files = grep{
$_ !~ /\.\.?$/ # filter . und ..
and
-f $dir.'/'.$_ # \374berpr\374fe, ob es eine datei ist
}readdir(DIR);
closedir(DIR);
print "Inhalt von $dir:\n";
foreach my $file (@files) {
#dateiname.20070117.001124.log
@info = $file =~ m/(.*)\.(\d{4})(\d{2})(\d{2})\.(\d{2})(\d{2})(\d{2})\.log/;
if ( $info[0] ne $oldname )
{
my %subhash = ();
@subhash{ qw/name year month day hour minute second/ } = @info;
$dif_hash{ $info[0] } = {
begin => { %subhash }
};
}
else
{
my %subhash = ();
@subhash{ qw/name year month day hour minute second/ } = @info;
$dif_hash{ $info[0] } = {
end => { %subhash }
};
}
$oldname = $1;
}
#print Dumper(\%dif_hash);
mittlerweile kommt als fehlermeldung "nur noch" das hier:
Use of uninitialized value at dir_4.pl line 28.
Use of uninitialized value at dir_4.pl line 33.
Use of uninitialized value at dir_4.pl line 33.