{
@l = split("\n",$line);
if($l =~ /Mozilla/)
{
print $line;
}
}
close INF;
1;
I'm trying to seperate a log file line by line, then see if the line has mozilla in it. If so, print that line.
Once through the log, exit. And I'm trying to get it to print to the screen.
Any pointers greatly appreciated. My logic is messed up, or something.
Jeremy
This will remove one level of complexity from the script - you can then match against $line directly:
if ($line=~/Mozilla/)
This should be enough to get things working - if not, just shout.
#!/usr/bin/perl -w
$filename = "my_log";
open (my_log, $filename) or die "Couldn't open $filename: $!";
while ($line = <my_log>)
{
if(/!=mozilla/ && /Apr..5/) { print; }
}
close INF;
1;
I'm getting
Use of uninitialized value in pattern match (m//) at mozGrap.cgi line 9, <my_log> line 134.
All down the screen...kind of cool, but not what I want. And if I don't use the -w switch, I don't get any output.
Thanks for the help before Sugarkane...anybody else want to take a stab at this now?
Jeremy