Perl Style: Reduce Complexity (solution)

  • Write this instead:

        while (C1) {
            unless (C2) {
                statement;
                next;
            }
            statements;
            next unless C3;
            statements;
        }
    
  • Or perhaps even:

        while (C1) {
            statement, next unless C2;
            statements;
            next unless C3;
            statements;
        }
    

Forward to Loop Hoisting
Back to Reduce Complexity
Up to index

Copyright © 1998, Tom Christiansen All rights reserved.

Tags

Feedback

Something wrong with this article? Help us out by opening an issue or pull request on GitHub

TPRF Gold Sponsor
TPRF Silver Sponsor
TPRF Bronze Sponsor