## untested, just something I thought up right now chomp( $input = ); my( $cmd, @args ) = split( /\s+/, $input ); if( defined( $commands{ $cmd } ) ) { $command{ $cmd }->( @args ); }