Perl Style: Break Complex Tasks Up

  • Break subroutines into manageable pieces.
  • Don’t try to fit everything into one regex.
  • Play with your ARGV:

        # program expects envariables
        @ARGV = keys %ENV       unless @ARGV;
    
        # program  expects source code
        @ARGV = glob("*.[chyC]") unless @ARGV;
    
        # program tolerates gzipped files
        # from PCB 16.6
        @ARGV = map { /^\.(gz|Z)$/ ? "gzip -dc $_ |" : $_  } @ARGV;
    

Forward to Break Programs into Separate Processes
Back to Loop Hoisting
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