First of all, as I'm sure many others will also tell you, I'd recommend
avoiding the use of the goto completely. It makes the code more difficult
to follow, and I've been told has some expensive overhead involved in
executing it. Take another look at your programming construct and see if
you can re-write it and achieve the same results without using the goto.
If the goto is the only way to achieve your goals (which is doubtful),
remember that a label is not something that exists by itself. A label is
marker for a statement. That is to say, that a label must be followed by a
statement or at bare minimum a semicolon (a no-op statement). The statement
doesn't have to be on the same line as the label, but a statement of some
type does need to immediately follow the label.
if (some condition) {
if (some condition) {
if (some case true) {
goto ENDDISP;
}
}
}
ENDDISP:; (note the semicolon after the colon)
> -----Original Message-----
> From: Flynn, Timothy J [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, May 02, 2000 10:16 AM
> To: Perl-Win32-Users Mailing List
> Subject: proper format for a label
>
>
> Hi All!
>
> I am using goto for the first time and I am having
> trouble with the
> label format. I have checked perldoc -f goto and perldoc -q
> label with no
> success. Here is an example of what I am doing..
>
>
>
>
> if (some condition) {
>
> if (some condition) {
>
> if (some case true) {
>
> goto ENDDISP;
> }
> }
> }
>
> ENDDISP: (note the colon)
>
> what is wrong? When I comment out ENDDISP: it runs. #
> although then the
> goto is meaningless. What format does this label ENDDISP:
> have to be in?
>
> Thanks!
> -Tim
>
> ---
> You are currently subscribed to perl-win32-users as:
> [EMAIL PROTECTED]
> To unsubscribe, forward this message to
> [EMAIL PROTECTED]
> For non-automated Mailing List support, send email to
> [EMAIL PROTECTED]
>
---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
[EMAIL PROTECTED]
For non-automated Mailing List support, send email to
[EMAIL PROTECTED]