You can use a hashtable lookup of closures (aka: code refs)
This would let you build up the hashtable in any order you want, possibly adding to it in multiple files (maintained by different people), possibly refering to methods / coderefs written by other people, in other packages.
Understanding how the example below works is left as an excersize fo the reader.
(hint: look at perldoc perlref)
#!/usr/local/bin/perl -wl
use strict;
my $function = $ARGV[0];
my $input_file = $ARGV[1];;
sub create_file {
my $file = shift;
open (NETH, ">$file");
#actions
print "Creating $file";
close (NETH);
}
my %function_registry =
(
'open' => sub {
my $file = shift;
open (BLAH, "$file");
#actions
print "Opening $file";
close (BLAH);
},
'create' => \&create_file
);
&{$function_registry{$function}}($input_file);
__END__
[hossman@laptop ~]$ monk.pl create /tmp/file
Creating /tmp/file
[hossman@laptop ~]$ monk.pl open /tmp/file
Opening /tmp/file