|There's more than one way to do things|
RE: RE: Number of times I've used goto in Perlby buzzcutbuddha (Chaplain)
|on Apr 19, 2000 at 22:20 UTC||Need Help??|
I have never used GOTO in Perl, but in Visual Basic, which I learned in school. There
it's used for error handling where you would say:
and then construct an appropriate subroutine underneath the ErrHandler tag to handle the error.
I believe the reason that VB uses GOTO in that situation is because an error can
conceivably occur at anypoint, and you want to be able to catch it immediately, instead
of wrapping things in a TRY..EXCEPT model. But that type of unexpected error seems to me
more of a problem in an 'event driven' piece of code, and not so much the style with which
Perl is used. Plus I think that it is more difficult to use than other methods I have seen.
So I personally cannot see the value of GOTO in Perl, though I do not deny it's validity, or the
skills of anyone who uses it.
just my $0.02..