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 $set = [];
my $record1 = {
hostname => 'box',
timestamp1 => '200412311931',
timestamp2 => '200503190712',
text => 'Hello World!',
# yada yada yada
};
my $record2 = {
hostname => 'box2',
timestamp1 => '200412311931',
timestamp2 => '200503190712',
text => 'foo bar baz',
# yada yada yada
};
push @$set, $record1;
push @$set, $record2;
print Dumper $set;
print Dumper grep { $_->{hostname} eq 'box' } @$set; # filtering records
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
#!usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
use constant {
HOSTNAME => 0,
TIMESTAMP1 => 1,
TIMESTAMP2 => 2,
TEXT => 3,
};
my $set = [];
my $record1 = [
'box',
'200412311931',
'200503190712',
'Hello World!',
# yada yada yada
];
my $record2 = [
'box2',
'200412311931',
'200503190712',
'foo bar baz',
# yada yada yada
];
push @$set, $record1;
push @$set, $record2;
print Dumper $set;
print Dumper grep { $_->[HOSTNAME] eq 'box' } @$set; # filtering records
8 Einträge, 1 Seite |