Leser: 19
my @sorted_keys = sort{ $hash{$a} cmp $hash{$b} } keys %hash;
my $lastmod = (stat ("/verz/datei"))[9];
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
#!/usr/bin/perl use strict; use warnings; my $basedir='/path/to/files/'; my @filelist=qw(irgenwas12 irgenwas34 irgenwas56 irgenwas78 irgenwas90); for my $file (@filelist) { my $date=''; my $name=$file; open(my $fh, '<', $basedir.$file) or die("ERROR open $basedir$file ($!)\n"); while(my $line=<$fh>) { ($date)=$line=~/^\{datestamp=(\d{12})\}/); last if($date); } close($fh); $file={name=>$name,date=>$date}; } @filelist=sort{$a->{date} cmp $b->{date}}@filelist; for my $file (@filelist) { print $file->{name}; print $file->{date}?' ('.$file->{date}.')':' (NO DATE FOUND)'; print "\n"; }