Which is one problem, and another is you're using the regex anchor \A which matches the beginning of a string. So you're matching berta226: to the beginning of the string, which will also make the regex fail. If you change your code to something like this you should get the desired output (updated - dropped extraneous semi-colon on second line. update 2: also fixed a further 2 mistakes as noted below .oO(note to self - don't post in a hurry shortly before leaving ... ))while(<FILE>) { ## assign $_ to readline *FILE my $message = <FILE>; ## assign my $message to readline *FILE
See. perlsyn and perlre for more info.while(my $message = <FILE>) { print "$1: $2<br/>" if $message =~ /^(Alberta226: )([a-zA-Z, 0-9]+)/; # I added the + }
_________
broquaint
In reply to Re: Parsing a file
by broquaint
in thread Parsing a file
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |