Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Data structure assistance

by tadman (Prior)
on Oct 16, 2002 at 13:55 UTC ( #205709=note: print w/replies, xml ) Need Help??


in reply to Data structure assistance

If you look at each fragment of your data, you'll probably realise how it's structured naturally. Once you've imported it, then the challenge is to restructure as required to generate the required output.

The first layer is your IP address. These fit naturally in to a hash. The second layer is domains, which will likewise be a good fit in a hash. The third is a list of times, and since you're probably not referencing them directly, these are array elements. For example:
my %data; $data{$ip_address}{$domain} = [ $time1, $time2, $time3 ]; push (@{$data{$ip_address}{$domain}}, $time4); # ... foreach my $time (@{$data{$ip_address}{$domain}}) { # ... }
So what you have is a hash of hash of arrays or HoHoA.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2022-08-09 19:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?