Untested code.

# Always...
use strict;
use warnings;

my %ip = ...;

#Get the lines as an array.
my @lines = keys %ip;

# Slight modification to the regex. Someone else's reply will probably
have a more elegant method.
my $ipSearch = qr/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/;

# Use variables for filehandles.
open my $CHANGE, "> $changeFile" or die;
print CHANGE "NO\n" unless ( grep ( $ipSearch, @lines ) );


Sorry for all the emails.  Here is another thing I have a question about.

is there a cleaner way to perform the following:

my @lines = keys(%Input);

print CHANGE "*** NO blah\n" unless ( grep ("blah", @lines) );
print CHANGE "*** NO blah2\n" unless ( grep ("blah2 $any_ipaddress", @lines) );
print CHANGE "*** NO blah3\n" unless ( grep ("blah3", @lines) );
print CHANGE "*** NO blah4\n" unless ( grep ("blah4 $some_pattern", @lines) );



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to