#!/usr/bin/perl -- Main( @ARGV ); exit( 0 ); sub Main { use Getopt::Long; my %opt; GetOptions( \%opt, ... ); my %needed = ValidateOptionsAndInitializeStuffWeNeed( \%opt ); return PrintHelp() if $opt{help_needs_to_happen}; return ReadTheLogBasedOnFormat( \%opt , \%needed ); } sub ValidateOptionsAndInitializeStuffWeNeed { my( $optref ) = @); ... if( ... ){ die "Unknown output type ..."; } ... }