use strict; my $input; my %commands; my $cmd; my %commands = ( greeting => \&greeting(), quit => \&end_program(), ); chomp( $input = ); my( $cmd, @args ) = split( /\s+/, $input ); if( defined( $commands{ $cmd } ) ) { $commands{ $cmd }->( @args ); } sub greeting { print "Weclome\n"; } sub end_program { print("Ending Program\n"); die; }