in reply to Variable in pattern matching line

maybe you copy'ed and pasted sloppy, but it works if I remove that extra paren:

#!/usr/bin/env perl my $first = 'match'; my $second = 'matching\.com'; my $third = 'match\.company'; my $data = 'matching.com'; my $test = $data =~ /(?:$first|$second|$third)/gi; print $test , "\n"; __END__ 1
be sure to check if $data is actualy a matching string, just print it to STDERR or something. Also it's a nice habit to post the occuring errors and sample data, helps a lot to help :)

regards,
tomte


Hlade's Law:

If you have a difficult task, give it to a lazy person --
they will find an easier way to do it.

Replies are listed 'Best First'.
Re: Re: Variable in pattern matching line
by Anonymous Monk on Jul 01, 2003 at 13:17 UTC
    Thanks to both of you for helping me solve this problem.