Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: How i can create hash of arrays of hashes from my 3 arrays?

by tybalt89 (Monsignor)
on Mar 13, 2021 at 11:53 UTC ( [id://11129566]=note: print w/replies, xml ) Need Help??


in reply to How i can create hash of arrays of hashes from my 3 arrays?

Just a guess...

#!/usr/bin/perl use strict; # https://perlmonks.org/?node_id=11129561 use warnings; my %hash; while( <DATA> ) { my ($one, $two, $three) = split /\s{2,}|\n/; $hash{$one}{$two}{$three}++; } for my $value ( values %hash ) { $_ = [ sort keys %$_ ] for values %$value; } use Data::Dump 'dd'; dd \%hash; __DATA__ 900000001 Network1 Login 900000002 Network1 2019-11-07T20:31:10.000Z 900000002 Network1 2021-02-19T13:47:25.000Z 900000002 Network1 2021-03-10T13:58:50.000Z 900000003 No Network1 NOT Registered 900000004 Network1 Login 900000005 Network1 Login 900000006 Network1 Login2 900000007 Network1 2021-03-10T17:11:24.000Z 900000007 Network1 2021-02-18T08:34:58.000Z 900000007 Network1 2021-01-25T17:19:44.000Z 500000008 Network1 2021-03-10T17:11:24.000Z 500000008 Network2 Not Used 500000008 Network1 2021-03-11T17:12:42.000Z 500000008 Network3 Not Used 400000008 Network1 2021-01-25T17:19:36.000Z

Outputs:

{ 400000008 => { Network1 => ["2021-01-25T17:19:36.000Z"] }, 500000008 => { Network1 => ["2021-03-10T17:11:24.000Z", "2021-03-11T +17:12:42.000Z"], Network2 => ["Not Used"], Network3 => ["Not Used"], }, 900000001 => { Network1 => ["Login"] }, 900000002 => { Network1 => [ "2019-11-07T20:31:10.000Z", "2021-02-19T13:47:25.000Z", "2021-03-10T13:58:50.000Z", ], }, 900000003 => { "No Network1" => ["NOT Registered"] }, 900000004 => { Network1 => ["Login"] }, 900000005 => { Network1 => ["Login"] }, 900000006 => { Network1 => ["Login2"] }, 900000007 => { Network1 => [ "2021-01-25T17:19:44.000Z", "2021-02-18T08:34:58.000Z", "2021-03-10T17:11:24.000Z", ], }, }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11129566]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2024-04-23 08:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found