# main perl script my $input; # defining ReadLine module for supporting my $term = new Term::ReadLine 'Command Line Interface'; print "\nWelcome to my command line interface (version $version)!\n\n"; while (defined($input = $term->readline("\n" . $prompt.' (main, exit, back, help) > '))) { chomp $input; $input =~ s/^\s+//; # delete leading spaces $input =~ s/\s+$//; # delete trailing spaces &parseCmdLine(); ... } sub parseCmdLine { ... local %hash; if (GetOptions(\%hash, 'netbios=s', 'winbind!', 'srvstring=s')) { &doSomething(); } ... }