Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to open a file log.txt which is a chat file. It is formated like:print header, start_html('log parsing'); open(FILE, "log.txt") or die "Cannot open file: $!"; while(<FILE>) { my $message = <FILE>; if ($message =~ m/(^\Alberta226: )([a-zA-Z, 0-9])/) { print "$1: $2<br>"; } } close (FILE) or die "Cannot close file: $!";
Why does my regex not pull back anything by Alberta226 when I see it in the actual log file?user1: hi there user2: hi buddy Alberta226: okay
Thanks
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Parsing a file
by broquaint (Abbot) on Jan 22, 2004 at 17:58 UTC | |
by sulfericacid (Deacon) on Jan 23, 2004 at 07:35 UTC | |
by Anonymous Monk on Jan 22, 2004 at 19:20 UTC | |
by ysth (Canon) on Jan 22, 2004 at 19:38 UTC | |
by Anonymous Monk on Jan 22, 2004 at 20:16 UTC | |
by Nkuvu (Priest) on Jan 22, 2004 at 20:27 UTC | |
|
Re: Parsing a file
by allolex (Curate) on Jan 22, 2004 at 18:07 UTC |