Output is#!/usr/bin/perl use strict; use warnings; use Data::Dumper; open FILE ,"temp" or die("can not open temp $!"); my $line ; my (%resultarray,$part1,$part2); my @AoH=(); while($line = <FILE>) { chomp($line); ($part1,$part2) = split(/#/,$line); my @resultarry2=split(/\s/,$part1); %resultarray=split(/[=;]/, $part2); my $datetime="$resultarry2[1] $resultarry2[2]"; my $threadname=$resultarry2[6]; $resultarray{"datetime"}=$datetime; $resultarray{"threadname"}=$threadname; push @AoH, \%resultarray; } close(FILE); my $numberofhashes=scalar(@AoH); print $numberofhashes."\n"; my $hr2=\@AoH; print Dumper $hr2;
4
$VAR1 = [
{
'threadname' => '241e2260-a74f-4122-af42-9def1fa0318c',
'eventType' => 'REQUESTUPDATE',
'objectType' => 'VE',
'objectId' => '1447553 ',
'requestType' => 'CREA',
' requestId' => '874',
'datetime' => '2011-08-12 10:05:19,250'
},
$VAR1->[0],
$VAR1->[0],
$VAR1->[0]
];
--------------------
In reply to problem in Pushing to Array of hash by perl_peter
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |