TStanley has asked for the wisdom of the Perl Monks concerning the following question:
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;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How could I make this code more optimized
by japhy (Canon) on Feb 06, 2002 at 20:41 UTC | |
by belg4mit (Prior) on Feb 06, 2002 at 21:09 UTC | |
|
Re: How could I make this code more optimized
by buckaduck (Chaplain) on Feb 06, 2002 at 20:52 UTC | |
|
Re: How could I make this code more optimized
by VSarkiss (Monsignor) on Feb 06, 2002 at 20:53 UTC | |
|
Re: How could I make this code more optimized
by TStanley (Canon) on Feb 08, 2002 at 17:58 UTC | |
by buckaduck (Chaplain) on Feb 14, 2002 at 02:07 UTC |