On 24/6/13 at 06:36, l...@yun.yagibdah.de (lee) wrote:

while($test) {
last if($foo) {
print $bar;
}
else {
print $test;
}
}

doesn't work.

Never mind “doesn’t work”; it doesn’t compile, because it is plain nonsense syntactically in whatever language.

Compare your meaningless string with the following valid possibilities:

if(statement_is_true) {do_this}
do_this if statement_is_true ;
statement_is_true ? do_this : do_that ;

What you are saying is rather like expecting meaning from a sentence like:

“Stop if it’s raining, open your umbrella.”

Nobody would know what you intend to say. No condition is actually attached to “stop”.

To sum up,

if (the horse is dead) { stop flogging it! }


JD








--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to