use strict; use warnings; use Data::Dumper qw(Dumper); my @sites=qw/ www.yahoo.com www.google.com www.comcast.com /; my @bad_log; LINE: while (my $line = <DATA>) { my $www = (split / /,$line)[5]; foreach my $site (@sites) { next if $site eq ""; if ( $www =~ /\Q$site/ ) { push @bad_log, $line; next LINE; } } } print Dumper \@bad_log; __DATA__ X456 TV-yes DB-no 123.12.23.45 dealio3 www.google.com-------- FX-yes d +53 Y-03 X123 TV-yes DB-yes 34.154.43.21 dealio1 www.ask.com-------- FX-no d01 +Y-03 X412 TV-no DB-no 192.365.25.23 rayovac2 www.microsoft.com--- FX-yes d1 +3 Y-07
Cheers Rolf
( addicted to the Perl Programming Language)
In reply to Re^3: divide one file into multiple arrays
by LanX
in thread divide one file into multiple arrays
by tevus_oriley
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |