For Quality purpouses, Thomas Browner 's mail on Thursday 29 January 2004
18:46 may have been monitored or recorded as:
> Does perl have a goto command. For example if you tell scrip to do
> something and it returns a 1 then it should go to a block of code that
> does something else.
Not talking
Thomas Browner wrote:
>
> Does perl have a goto command. For example if you tell scrip to do
> something and it returns a 1 then it should go to a block of code that
> does something else.
Yes. But I've never seen a case where I think it should be used.
Perl isn't a scripting language. (Although
Sub dothissubroutine {
Do something
If return this
Else return this
}
My $result = &dothissubroutine
If $result = this
}elsif
This
}else{
This
}
Paul Kraus
---
PEL Supply Company
Network Administrator
> -Original Message
Why not just make it a sub, so you perform the sub and continue on from there:
if ( sub1() ) {
# return of true
sub2();
}else {
# return false, so do something else or nothing
}
Wags ;)
-Original Message-
From: Thomas Bro
The reason why the goto command is not generally used in perl (and other
languages) is that it does not force the developer to have a theoretical
framework for the program. It creates 'spagetti code' where a person working
on the code or trying to understand what the developer has done has to
follo