Millhost said:
> Dear All
>
> I am using this script to get my maillog information
>
> ##
> %IP_LOG=();
> open (LOG,/var/log/maillog);
> foreach (<LOG>) {
> if (/Sep 20/) {
> $IP_LOG{$_}++;
> }
> }
> ##
> I found this script will take 3-4 second when my log file in 40MB
> But I try using gerp "Sep 20" /var/log/maillog in bash shell, it take 0.8
> sec only.Try using while(<>), so it processes it straight away. I think I am correct in saying, foreach reads in the whole file first? > > Did any one know how to optimize the script to have better performance. > > Thanks all > > -- > > > --------------------------------------------------------------------- > "Are you still wasting your time with spam?... > There is a solution!" > > Protected by GIANT Company's Spam Inspector > The most powerful anti-spam software available. > http://mail.spaminspector.com > > > > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > <http://learn.perl.org/> <http://learn.perl.org/first-response> > > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>
