[Pdx-pm] hashes

Robby Russell robbyrussell at pdxlug.org
Tue Jul 29 12:57:08 CDT 2003


I assume I can ask programming questions here, correct? :-p Since I've
joined I haven't seen many...anyhoo.

I have a hash...and I'm constantly populuting the hash of ip addresses and
timestamps.

So, I have a limit of how many timestamps for each ip address in my hash.

%hash_ips
  1 => 0101010 (timestamp)
  2 -> 014509249 (timestamp) and so on

It's working all fine and dandy, but I'm not getting rid of hash
keys/values that are older than a determined # of seconds.

So what I'd like to do is compare each first entry in the hash to the
current timestamp each time a function is run.

Is there an easy-ish method to accomplishing this?

   # Populate hash
    push(@{ $hash_ips{$host} }, $logTime );

The logtimes/current time are in EPOCH as well.

Thanks for any input, (goes back to his cookbooks)


-- 
Robby Russell
Portland Linux User Group
http://www.pdxlug.org/



More information about the Pdx-pm-list mailing list