You don't seem to understand how the while (<FILEHANDLE>) and regex comparison code works. Maybe you've already moved past this, but just in case, I'll explain.
Your while loop reads in a line at a time from the file, using \n to detect the end of a line. The string representing that line is placed in $_, which is used as input for your regular expression. So you are testing your regex first against:
[Fri Sep 30 14:02:22 2005]Local/ESSBASE0///Info(1051001)
... and then are printing out the $1 through $9 components you have extracted by the use of parentheses. Then you finish and do it all over again with the second line:
Received client request: Logout (from user Procbat)
The second line doesn't have any bracket characters and so your regex doesn't work on that line at all, and the print statements inside your if block aren't executed.
ikegami's recommendation (and mine, for that matter) involve joining the multiple lines in your file.
Hope that helps. | [reply] [d/l] [select] |
I obtained the 2 second line ;) thanks for all answers, the final solution:
while (<>)
{
chomp;
$buffer .= $_ ;
}
if ($buffer =~m{ \[ (\w{3}) \s* (\w{3}) \s* (\d{2}) \s*
(\d{2}:\d{2}:\d{2})\s*
(\d{4}) \]
(\w*) \/ (\w*) /// Info(\(\d*\))
(\w*)
}xm
){
print "regexp ok\n";
print "$buffer";
print "$1\n";
print "$2\n";
print "$3\n";
print "$4\n";
print "$5\n";
print "$6\n";
print "$7\n";
print "$8\n";
print "$9\n";
print "$10\n";
print "$11\n";
}
Lorn
-www.slackwarezine.com.br-
| [reply] [d/l] |