Is there any way I could improve the overall speed of this? I have already sped up the overall program by a minute, just from pre-compiling the regular expressions, but I would like to clean this section up as well. As usual, any ideas/suggestions are appreciated.open(RPT,">$DIR/$RPT")||die"Can't open $RPT: $!\n"; print RPT "Report Date: $month/$day/$year\n"; print RPT "$RPT\n"; print RPT "============================\n"; my($key,$msg); foreach $key(keys %hash){ foreach $msg(@Messages){ if($hash{$key}{'error_message'}=~/$msg/ and $hash{$key}{'date'}=~ +$DATE){ print RPT "$hash{$key}{'packet_id'}\t\t$hash{$key}{'origin'}\n +"; print RPT "$hash{$key}{'date'}\t$hash{$key}{'qualifier'}\n"; print RPT "$hash{$key}{'time'}\t$hash{$key}{'terminal_id'}\n"; print RPT "$hash{$key}{'device_id'}\t\t$hash{$key}{'applicatio +n_id'}\n"; print RPT "$hash{$key}{'catalog_code'}\t\t$hash{$key}{'functio +n_id'}\n"; print RPT "$hash{$key}{'status'}\t\t$hash{$key}{'severity'}\n" +; print RPT "$hash{$key}{'error_message'}\n"; print RPT "=================================================== +=\n"; }## END OF IF STATEMENT }## END OF INNER FOREACH STATEMENT }## END OF OUTER FOREACH STATEMENT close RPT;
In reply to How could I make this code more optimized by TStanley
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |