>        (We initially used a "goto FINISH", but I hated that, too. You can
use a "break" if you're in a loop.) 

you can also just surround the code in {} to make it a block and then use
"last;" 

in perldoc -f last
        Note that a block by itself is semantically identical to a loop
        that executes once. Thus "last" can be used to effect an early
        exit out of such a block.

What version of perl/platform are you using? 

Kind regards,

Mark Anderson
Team Leader - RSWI
1st Floor, The Broadstone
50 South Gyle Crescent
Edinburgh, EH12 9UX
Tel: 0131 523 7630
Mob: 07808 826 063


> -----Original Message-----
> From: [EMAIL PROTECTED]
> [SMTP:[EMAIL PROTECTED]
> Sent: Wednesday, July 13, 2005 2:55 PM
> To:   perl-win32-users@listserv.ActiveState.com
> Subject:      Re: Change in "goto" behavior
> 
> *** WARNING : This message originates from the Internet ***
> 
> At 08:30 AM 7/13/2005, Hugh Loebner wrote:
> 
> 
>       Why on earth are you using a goto statement?  They are pernicious.
> 
> 
> We have a goto in our code. I hate it, but there just isn't a good
> "switch" or "case" statement in Perl yet (I think I've heard that it's
> planned), and the following just isn't efficient enough for us:
> 
> if ($op = 'thisop') {
>         }
> elsif ($op = 'thatop') {
>         }
> ...
> 
> There are hundreds of possible values for $op. Anyway, I don't know how
> many people are aware of it, but the destination of a "goto" can be a
> variable, e.g.
> 
> goto $op;
> 
> thisop:
>          do_this();
> thatop:
>          do_that();
> 
> Of course, you then have to prevent the fall through from the code for
> thisop: to the code for thatop:, but that's another matter. (We initially
> used a "goto FINISH", but I hated that, too. You can use a "break" if
> you're in a loop.) We use a method that I really don't have time to
> describe now, but doesn't use a "goto". I hate goto's, but for the example
> above, it's efficient and much clearer than e.g. setting up a hash of op
> names and code to handle each op.
> 
> 
> 
>       On 7/12/05, Dave Ressler <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
>       
> 
>               I have noticed a change in behavior in "goto" statements
> recently. Whereas a statement like "goto PLACE;" would work fine no matter
> where "PLACE:" was in my code, I've noticed that scripts that used to work
> are now failing at the "goto" statement.
>               
>                
>               
>               I can probably work out an example if needed, but the
> general question is: have any restrictions been put on "goto" recently?
> What are the real criteria needed to be satisfied for the destination to
> be successfully found?
>               
>                
>               
>               Thanks,
>               
>               Dave
>               
>               
>               _______________________________________________
>               
>               Perl-Win32-Users mailing list
>               
>               Perl-Win32-Users@listserv.ActiveState.com
> <mailto:Perl-Win32-Users@listserv.ActiveState.com>
>               
>               To unsubscribe:
> <http://listserv.ActiveState.com/mailman/mysubs>
>               
>               
>               
> 
> 
>   _____  
> 
>       Scanned for Spam and Viruses. 
>       Content-Type: text/plain; charset="us-ascii"
>       MIME-Version: 1.0
>       Content-Transfer-Encoding: 7bit
>       Content-Disposition: inline
>       X-NAIMIME-Disclaimer: 1
>       X-NAIMIME-Modified: 1
>       
>       _______________________________________________
>       Perl-Win32-Users mailing list
>       Perl-Win32-Users@listserv.ActiveState.com
>       To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
> <http://listserv.activestate.com/mailman/mysubs>
>       
>       
>       Scanned for Spam and Viruses.
>  << File: ATT1514841.txt >> 


The Royal Bank of Scotland plc, Registered in Scotland No. 90312. Registered 
Office: 36 St Andrew Square, Edinburgh EH2 2YB

The Royal Bank of Scotland plc is authorised and regulated by the Financial 
Services Authority and represents The Royal Bank of Scotland Marketing Group. 
The Bank sells life policies, collective investment schemes and pension 
products and advises only on the Marketing Group's range of these products and 
on a With-Profit Bond produced by Norwich Union Life (RBS) Limited.

This e-mail message is confidential and for use by the addressee only. If the 
message is received by anyone other than the addressee, please return the 
message to the sender by replying to it and then delete the message from your 
computer. Internet e-mails are not necessarily secure. The Royal Bank of 
Scotland plc does not accept responsibility for changes made to this message 
after it was sent.

Whilst all reasonable care has been taken to avoid the transmission of viruses, 
it is the responsibility of the recipient to ensure that the onward 
transmission, opening or use of this message and any attachments will not 
adversely affect its systems or data. No responsibility is accepted by The 
Royal Bank of Scotland plc in this regard and the recipient should carry out 
such virus and other checks as it considers appropriate.

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to