Take a look at the grep function
http://perldoc.perl.org/functions/grep.html

Also of potential use is the qr// quote operator:
http://perldoc.perl.org/perlop.html#Regexp-Quote-Like-Operators

This lets you do:

my $ip_search = qr/$ip_string/;
my @lines_with_ip = grep /$ip_search/, @raw_data; # or is that grep
$ip_search, @raw_data; ?

Now you got an array with only lines that got the ip.

my $i = 0;
foreach @lines_with_ip {
  print $_;
  $i++;
}
print "The IP was found $i times\n";

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


Reply via email to