#!/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