in reply to Re: Bizarreness in ?PATTERN? and g
in thread Bizarreness in ?PATTERN? and g

So, hmm. It seems ?? only acts differently if it's inside a loop. The perlop docs mention reset, and reset is only really useful for loops, so perhaps ?? is too? Hopefully someone who knows will come clear this up.

Replies are listed 'Best First'.
Re^3: Bizarreness in ?PATTERN? and g
by ysth (Canon) on Jun 04, 2004 at 07:15 UTC
    Each occurence of ?? in code will match only once beteen resets. If you have more than one ??, each one can match once.
Re^3: Bizarreness in ?PATTERN? and g
by beth (Scribe) on Jun 04, 2004 at 18:20 UTC
    japhy took a look at this but I guess he didn't post about it yet. Basically, loops and repeated statements are not interchangeable - they're compiled differently. He suggested running the following two tests, which are quite enlightening:
    perl -MO=Terse -e '/x/; /x/;' perl -MO=Terse -e '/x/ for 1, 2'


    --
    eval pack("H*", "7072696e74207061636b2822482a222c202236613631373036382229");
    # japh or forkbomb? You decide!