#!/usr/bin/perl -w use strict; print "************************************\n"; print "* test - shift9999\n"; print "* Version 0.1 - \"The mule\"\n"; print "************************************\n"; print "\n"; while ( (print "\nEnter Command...: "), (my $line = ) !~ /^\s*q(uit)?\s*$/i ) { next if ( $line =~ /^\s*$/); #skip blank lines #and reprompt w/o error msg chomp ($line); #I would be these if statements on one line, but here they are too long for that... if ($line =~/^\s*one/i) {one($line,{parm1 => 'abc'});} # "one" command elsif ($line =~/^\s*two/i) {two($line);} # "two" command #...etc.. else {print "Invalid command entry!\n";} } sub one { my $line = shift; my $default_href = shift; my %defaults = %$default_href; print "sub one has $line as input line\n"; foreach my $default ( keys %defaults) { print "default: $default is $defaults{$default}\n"; } } sub two { my $line = shift; print "subroutine two has $line as input line\n"; my %defaults = (xyz => '123', ghig => '446'); foreach my $default ( keys %defaults) { print "default: $default is $defaults{$default}\n"; } } __END__ Example Interaction: Enter Command...: one sub one has one as input line default: parm1 is abc Enter Command...: two subroutine two has two as input line default: ghig is 446 default: xyz is 123 Enter Command...: three Invalid command entry! Enter Command...: quit