Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Your favourite gory detail...

by tilly (Archbishop)
on Jun 24, 2004 at 22:51 UTC ( #369510=note: print w/replies, xml ) Need Help??


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()."

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://369510]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2021-10-18 13:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (74 votes). Check out past polls.

    Notices?