in reply to Re: Cantor's Revenge Matching
in thread Cantor's Revenge Matching

So the value in $h is being used as regex code. Somehow I thought the pattern needed to pre-compiled using qr//.

$h =  qr/../;

Thank you so much for the answer.

Replies are listed 'Best First'.
Re: Re: Re: Cantor's Revenge Matching
by Paladin (Vicar) on May 01, 2003 at 17:41 UTC
    Correct. Regexen go through double-quotish interpolation (with a few exceptions, like using single quotes as the delimiters) before being passed on to the regex engine, so you can say stuff like:
    my $foo = 'first part'; my $anything = '.*'; my $bar = 'last part'; $_ =~ /$foo$anything$bar/;
    and have it mean the same as:
    $_ =~ /first part.*last part/;