On 6 Aug., 16:45, [EMAIL PROTECTED] (Yitzle) wrote: > On Wed, Aug 6, 2008 at 4:29 AM, Kenneth Brun Nielsen
> <[EMAIL PROTECTED]> wrote: > > Within a perl program, I want to go to a particular mode when a > > keyword is found. The keyword is a regexp. > > > E.g. > > #!/usr/bin/perl -w > > open FILEHANDLE, "soatest.soa"; > > while (<FILEHANDLE>){ > > if (/^\*| XI/) { > > print "match in line: $.\n"; > > } > > } > > > This conditional seems to be true for all lines (although they don't > > match /^\*| XI/). What is the correct syntax? > > > Best regards, > > Kenneth > > It helps if you can provide sample data that you can replicate the issue with. Thanks, Yitzle. In the mean time, I found out that the problem was the regex. I forgot to escape the pipe. /Kenneth -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/