bittoni has asked for the wisdom of the Perl Monks concerning the following question:
The numbers listed are what are in the file, ie 243001 454097 etc... the two print lines that are commented out i put in to try and debug it and the output from the $grepstring is the same as the original output. The problem that i am having is that the$filename = "/var/tmp/log.out"; open(FILE, $filename) || &error(); @file = <FILE>; close(FILE); $filter = "/var/tmp/messages_filter"; open(FILE, $filter) || &error(); @filefilter = <FILE>; close(FILE); START_HTML $lines_in_filter = @filefilter; if($lines_in_filter != 0){ foreach $filterline (@filefilter){ chomp($filterline); if ($grepstring ne "" ){ $joiner = "&&";} $grepstring = "$grepstring $joiner (!/$filterline/)"; } } else{ print "<TR><TD>File is empty</TD></TR>"; } #print "$grepstring"; #print "(!/243001/) && (!/454097/) && (!/858035/) && (!/872937/) && (! +/427199/)"; @file1 = grep($grepstring, @file); #@file1 = grep((!/243001/) && (!/454097/) && (!/858035/) && (!/872937/ +) && (!/427199/), @file); print "@file1";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Variable problem inside an array
by Corion (Patriarch) on Apr 15, 2009 at 14:38 UTC | |
by bittoni (Initiate) on Apr 15, 2009 at 15:33 UTC | |
|
Re: Variable problem inside an array
by jwkrahn (Abbot) on Apr 15, 2009 at 15:25 UTC | |
by bittoni (Initiate) on Apr 16, 2009 at 08:31 UTC | |
|
Re: Variable problem inside an array
by ELISHEVA (Prior) on Apr 15, 2009 at 20:33 UTC |