If I am understanding you correctly, you could store each record in a HoHoHoA. For each record you read in, you would need the following psuedo code:
my $IP = #extract from %data;
my $userAgent = #extract from %data;
my $date = #extract from %data;
my $aRequests = $hRequests{$IP}{$userAgent}{$date};
push @$aRequests, \%data;
Then after you have read in all the requests, loop through %hRequests using the hash keys to select
the requests that interest you. The pseudo code would look something like this:
while (my ($IP, $hUserAgents) = each(%hRequests)) {
next if #IP is boring;
while (my ($userAgent, $hDates = each(%$hUserAgents)) {
next if #user agent is boring;
while (my ($date, $aRequests) = each(%$hDates)) {
#do something if date is in range
#wanted for $IP, $userAgent
}
}
}
There's a lot of work navigating references to hashes and arrays here. As moritz said previously, studying perldata, perlref (or perlreftut) and perldsc might be well worth your time.
Best, beth |