But if I try the for example that demerphq quotes under Perl 5.5.3 (on FreeBSD), I get ...
for (;;) ne for (EXPR; EXPR; EXPR). The expressionless C-style for is special: it's an infinite loop. while (1) would be very inefficient, because it would have to check an expression on every iteration. Perl is smart, and knows what you're doing, and optimizes as follows:
You see? it's converted to for (;;) because it's more effecient. We can't benchmark the difference because of this optimization...2;0 juerd@ouranos:/root$ perl -MO=Deparse -e'while (1) { print }' for (;;) { print $_; } -e syntax OK
U28geW91IGNhbiBhbGwgcm90MTMgY
W5kIHBhY2soKS4gQnV0IGRvIHlvdS
ByZWNvZ25pc2UgQmFzZTY0IHdoZW4
geW91IHNlZSBpdD8gIC0tIEp1ZXJk
In reply to Re: Re: Re: Re: Re: infinite loop on while (@array)
by Juerd
in thread infinite loop on while (@array)
by jrasillo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |