in reply to Re: "Quantifier follows nothin" error?
in thread "Quantifier follows nothin" error?

I ran it from the shell, and it gave me the same error but pointed to a question mark on line 73. But I don't see what's wrong:
$newurl = "/$newurl"; if ($newurl =~ "\?") { # line 73 (I think) ($newurl,$junk) = split(/\?/, $newurl, 2); }

Replies are listed 'Best First'.
Re: Re: Re: "Quantifier follows nothin" error?
by sauoq (Abbot) on Oct 29, 2003 at 01:18 UTC

    This

    if ($newurl =~ "\?") { # line 73 (I think)
    should be:
    if ($newurl =~ /\?/) {
    The problem is that the string on the right hand side is being treated as the regular expression to match... but the backwhack is treated as an escape, so the regex becomes simply /?/ and hence the quantifier (?) "follows nothing."

    -sauoq
    "My two cents aren't worth a dime.";