perl_peter has asked for the wisdom of the Perl Monks concerning the following question:
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]
];
--------------------
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: problem in Pushing to Array of hash
by jwkrahn (Abbot) on Sep 28, 2011 at 10:23 UTC | |
|
Re: problem in Pushing to Array of hash
by Anonymous Monk on Sep 28, 2011 at 09:22 UTC | |
|
Re: problem in Pushing to Array of hash
by CountZero (Bishop) on Sep 28, 2011 at 13:10 UTC | |
by perl_peter (Initiate) on Sep 28, 2011 at 14:06 UTC | |
|
Re: problem in Pushing to Array of hash
by perl_peter (Initiate) on Sep 28, 2011 at 09:21 UTC |