Griggs Rob wrote:
>
> Hi Guys,
Hello,
> The code below extracts an ip address from the /var/log/maillog file in the
> event of the line containing the words "reject=550". It works fine, but is
> there a way of shortening that regular expression?
You can save six characters by removing the '$_ =~ ' at the beginning.
:-)
> open(LOG,"/var/log/maillog");
>
> while(<LOG>) {
> chomp;
> if($_ =~ /reject=550/) {
>
> if($_ =~ /\[(\d+\.\d+\.\d+\.\d+)\]/) {
> $address = $1;
>
> # Add address to firewall filtering here
> }
> }
> }
> close(LOG);
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]