8 Einträge, 1 Seite |
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;
use Data::Dumper;
my $dir = '/path/to/directory';
{
opendir(DIR,$dir) or die $!;
my @files = grep{$_ !~ /\.?\./}readdir(DIR);
closedir DIR;
local $/ = "\nFeld";
my @array;
for my $file(@files){
my %hash;
open(my $fh,'<',$file) or die $!;
while(my $line = <$fh>){
chomp $line;
my ($nr) = $line =~ /^\s*(\d+)/;
$hash{$nr} = $line;
}
close $fh;
push @array,\%hash;
}
@array = sort{$a->{1} cmp $b->{1}}@array;
}
print Dumper(\@array);
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
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
my $dir = 'd:\\test';
{
opendir(DIR,$dir) or die $!;
my @files = grep{$_ !~ /\.?\./}readdir(DIR);
closedir DIR;
local $/ = "\nFeld";
my @array;
for my $file(@files){
my %hash;
open(my $fh,'<',$file) or die $!;
while(my $line = <$fh>){
chomp $line;
my ($nr) = $line =~ /^\s*(\d+)/;
$hash{$nr} = $line;
}
close $fh;
push @array,\%hash;
}
@array = sort{$a->{1} cmp $b->{1}}@array;
print Dumper(\@array);
}
8 Einträge, 1 Seite |