in reply to Converting RegExs.
This works just fine. The included variable contents in $pat cannot cause the delimiters to be prematurely recognized; that phase is already long past.my $pat = "/etc/"; my $string = "/usr/etc/config"; if ($string =~ m/$pat/x) { print "it matches\n"; }
-- Randal L. Schwartz, Perl hacker
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: Re: Converting RegExs.
by dcorbin (Sexton) on Sep 02, 2000 at 23:41 UTC | |
|
RE: Re: Converting RegExs.
by BlaisePascal (Monk) on Sep 04, 2000 at 09:40 UTC | |
by merlyn (Sage) on Sep 04, 2000 at 17:53 UTC | |
by davorg (Chancellor) on Sep 04, 2000 at 18:31 UTC | |
by tilly (Archbishop) on Sep 04, 2000 at 18:40 UTC | |
by dcorbin (Sexton) on Sep 05, 2000 at 16:59 UTC |