On Thu, Apr 14, 2011 at 11:27 PM, Peter Scott <pe...@psdt.com> wrote: > On Thu, 14 Apr 2011 10:47:17 -0700, sono-io wrote: > >> On Apr 14, 2011, at 10:15 AM, Uri Guttman wrote: >> >>> goto just shouldn't be in your vocabulary. there is no reason for it at >>> all in any decent language, especially perl. >> >> I've been following this thread and I'm just curious. If goto is > so >> bad, why did they add it to Perl? > > Perl's goto is pretty old. Larry was feeling permissive and in a frame > of mind to make BASIC programmers happy. He regrets it. The perldoc for > goto says he has never found a reason to use it. >
but, sense it is jumping to a different place in the stack, isn't it more efficient than doing the above mentioned my $done = 0; while( !$done ){ $done = 1 if( contition ); do_work; } vs for(;;) { goto DONE if( contition ); do_work; } label DONE; i'd think the later would be faster not only because you are jumping to a memory location and because you're not assessing a value every time. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/