Using the data you posted, it dumps:#!/usr/bin/perl use strict; use warnings; my @data; my $keys = 'Log Name|Source|Date|Event ID'; { local $/ = ''; while (<DATA>) { chomp; my %temp = /($keys): (.+)/g; if (/^\s+Description:\s+(.+)\z/sm) { $temp{description} = $1; } push @data, \%temp; } } use Data::Dumper; print Dumper \@data;
Chris$VAR1 = [ { 'Event ID' => '7320', 'Log Name' => 'Microsoft-Windows-GroupPolicy/Operational', 'Source' => 'Microsoft-Windows-GroupPolicy', 'description' => 'Error: Computer determined to be not in +a site. Error code 0x77F.', 'Date' => '2014-06-26T13:58:04.290' }, { 'Event ID' => '7320', 'Log Name' => 'Microsoft-Windows-GroupPolicy/Operational', 'Source' => 'Microsoft-Windows-GroupPolicy', 'description' => 'Error: Computer determined to be not in +a site. Error code 0x77F.', 'Date' => '2014-06-26T12:32:30.009' } ];
In reply to Re: question on data structure
by Cristoforo
in thread question on data structure
by natxo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |