Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Strange aliasing(?) when modifying variable in range operator

by LanX (Saint)
on Jun 09, 2018 at 18:39 UTC ( [id://1216270]=note: print w/replies, xml ) Need Help??


in reply to Strange aliasing(?) when modifying variable in range operator

> Edit 2. But what about the do

(see also Re^3: Strange aliasing(?) when modifying variable in range operator)

I think it's the right side of for which is a statement in it self and does optimization (foreach has lot's of magic, it's also aliasing)

D:\Users\lanx>perl -wE "$i=0; say for do{$i},$i++" 1 0

BUT ... (wow oO ???)

DB<3> $i=0; say for do{$i},$i++ 0 0

apparently different levels of optimizations are exposed here when the debugger does an eval on the entered line.

DB<4> say $] 5.016003

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-04-26 01:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found