http://www.perlmonks.org?node_id=369510


in reply to Your favourite gory detail...

That pos($foo) = pos($foo); is not a no-op.

Replies are listed 'Best First'.
Re^2: Your favourite gory detail...
by Ido (Hermit) on Jun 25, 2004 at 02:03 UTC
    Took me about an hour to find code that has different output with and without that line... But it was fun;), so I won't spoil...

    $foo='hello'; for(1..5){ $foo=~/(?=(.))/g; pos($foo)=pos($foo); print $1 }

    "The additional state of being matched with zero-length is associated with the matched string, and is reset by each assignment to pos()."