in reply to Re: How could I make this code more optimized
in thread How could I make this code more optimized

To repeat one of my earlier suggestions:

Why on Earth are you testing $ref->{date} eq $Date inside of the inner foreach loop? If they're not equal, skip the inner foreach loop altogether!

Admittedly, this was probably more important back when you were using a regex match instead of eq. But it could still make a big difference...

Update: And while I'm at it, these lines:

foreach $key (keys %hash) { $ref = $hash{$key};
Can be replaced with this:
foreach $ref (values %hash) {

buckaduck