Leser: 1
|< 1 2 3 4 >| | 34 Einträge, 4 Seiten |
1
2
3
my ($key) = (sort keys %sorted_dates)[-1];
my ($version) = $sorted_dates{$key} =~ /-([^:])+:/;
print $version,"\n";
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
#!/usr/bin/perl
use strict;
use warnings;
#read in the data respective with dates etc.
my @result = ("AUDIO2-A3.12_P1:project:BmwWtz#1 Wed May 31 13:35:31 2006\n",
"AUDIO2-A3.00_P1:project:BmwWtz#1 Wed Sep 34 11:22:57 2006\n",
"AUDIO2-A3.30_P1:project:BmwWtz#1 Wed Sep 13 00:00:00 1999\n",
"AUDIO2-A2.17_P1:project:BmwWtz#1 Wed Sep 20 30:06:45 1870\n",
"AUDIO2-A5.17_P1:project:BmwWtz#1 Wed Sep 13 17:45:63 2220\n",
"AUDIO2-A9.8:project:BmwWtz#1 Mon May 30 18:18:02 2006\n");
#declare array converting letter months to number months
my %months = ( "Jan" => "01",
"Feb" => "02",
"Mar" => "03",
"Apr" => "04",
"May" => "05",
"Jun" => "06",
"Jul" => "07",
"Aug" => "08",
"Sep" => "09",
"Oct" => "10",
"Nov" => "11",
"Dec" => "12"
);
printsorted(@result);
sub printsorted {
my @lines = @_;
#define sort_dates array
my %sort_dates = ();
#take the data from months and input it with the rest of the string
foreach my $string_line (@lines)
{
if( $string_line =~ /(.*#[0-9])\s+[a-zA-Z]{3}\s+([a-zA-Z]{3})\s+(\d{1,2})\s+(\d{2}):(\d{2}):(\d{2})\s+(\d{4})$/ ) { #sorts out sparts via regex
print $7,"\n";
$sort_dates{$7.$months{$2}.$3.$4.$5.$6} = $1;
}
}
my ($key) = (sort keys %sort_dates)[-1];
my ($version) = $sort_dates{$key} =~ /-([^:]+):/;
print $key," -- ",$sort_dates{$key}," -- ",$version,"\n";
}
|< 1 2 3 4 >| | 34 Einträge, 4 Seiten |