Along with the fine comments by fishbot_v2, I'd also like to point out that your subroutines need not be named. This is the perfect situation to use anonymous subroutines. Here's how I would define your hash:
my %commands = ( "set time" => sub { print "nMetrics>You have entered the settime command\n"; print "nMetrics>The argument given is $_[0]\n"; }, "show time" => sub { print "nMetrics>You have entered the show time command\n"; }, default => sub { print "nMetrics>Invalid command line options\n"; } );
In reply to Re^5: CLI using hashes
by revdiablo
in thread CLI using hashes
by bahadur
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |