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

Re: Data structure assistance

by tadman (Prior)
on Oct 16, 2002 at 13:55 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2024-03-29 15:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found