#!/usr/bin/perl -w use warnings; use strict; print "\nfoo script\n\n"; srand time + $$ + $^T; my $action = shift(@ARGV); die "Usage here\n" unless $action; my $execute = new main; my $_action = "_$action"; die "Unknown action '$action'\n\nUsage here\n" unless can $execute $_action; $execute->$_action(); exit; ############################################################################## ############################################################################## use Getopt::Long; # use Other::Modules::Here; sub new { my $class = shift; my %self; GetOptions(\%self, qw(various options here)); # do more stuff with %self here return bless \%self, $class; } sub _add { my $self = shift; # we can see commandline parameters in %$self now } sub _mod { my $self = shift; # ditto } sub _del { my $self = shift; # again } sub foo { # ... } sub bar { # ... }