in reply to how to deal with 20 commands

Use a dispatch table, a hash with your commands as keys and code references as values,

my %dispatch = ( start => sub { my @args = @_; # . . . }, # . . . ); while (<STDIN>) { my ($cmd, @args) = split; exists $dispatch{$cmd} or warn 'Unknown command: ', $cmd and next; $dispatch{$cmd}(@args); }

After Compline,
Zaxo