T
Tony Walker
Hi Guys,
OK, what I'm doing is a basic search of a logfile for specific
strings. At present I have this working fine by manually creating an
array and foreaching it..
However, I now want to read these strings from a file and perform the
same actions as before but I'm hitting a problem. I slurp the file
into and array and it only ever finds ONE of the strings in the file,
not the other!!
Any help much appreciated..
Tony
p.s this is my first attempt at perl so it may not look great...
##
#!/opt/perl/bin/perl
open (ER,"ALL_errors") or die "$!";
my @entry = <ER>;
open (LOG,"all.log") or die "$!";
while (<LOG>){
my $CUR=$_;
for (my $i=0;$i<=$#entry;$i++) {
my $LINE = @entry[$i];
if ($CUR =~/$LINE/){
print $CUR;
}
}
}
####
OK, what I'm doing is a basic search of a logfile for specific
strings. At present I have this working fine by manually creating an
array and foreaching it..
However, I now want to read these strings from a file and perform the
same actions as before but I'm hitting a problem. I slurp the file
into and array and it only ever finds ONE of the strings in the file,
not the other!!
Any help much appreciated..
Tony
p.s this is my first attempt at perl so it may not look great...
##
#!/opt/perl/bin/perl
open (ER,"ALL_errors") or die "$!";
my @entry = <ER>;
open (LOG,"all.log") or die "$!";
while (<LOG>){
my $CUR=$_;
for (my $i=0;$i<=$#entry;$i++) {
my $LINE = @entry[$i];
if ($CUR =~/$LINE/){
print $CUR;
}
}
}
####