in reply to Re^2: Number of times I've used goto in Perl (sub, return++)
in thread Number of times I've used goto in Perl
... subroutines ... extra returns ...
I don't understand these points.
Certainly using multiple returns and/or refactoring code into subroutines can, in general, be extremely useful for improving the readability/reliability/maintainability of code.
But the particular code example presented in Re: Number of times I've used goto in Perl has a rather unusual structure. There are two interleaved streams of function calls and instructions:
Using multiple returns and/or refactoring into subroutines (or even (shudder) using nested if-elsif-else blocks or conditional goto statements), it would certainly be possible to replicate the control flow of the OPed code, but again, I can't see how it would be any improvement on anonymized user 468275's basic approach; indeed, it seems to me that it could only be much worse. Can you give an example of what you envision?
Give a man a fish: <%-(-(-(-<
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: Number of times I've used goto in Perl (early return)
by tye (Sage) on Mar 26, 2015 at 01:32 UTC |