if the command eq '?' I want to print a help menu,
else I want to handle a scalar command. How do I deal with $parm in the following example:
#Main:
my ($cmd,$parm) CmdListParser($cmd);
if ( $parm is a SCALAR ) {
handle the scalar;
exit;
}
if ( $parm is a HASH ) {
print the hash;
exit;
}
#End-------------------------------------
sub CmdListParser {
my $input = shift;
my %commandList = (
'cmd1' => 'cmd1 description' ,
'cmd2' => 'cmd1 description' ,
'?' => 'Print This Hash' ,
);
if ( $input eq '?' ) {
return($cmd,%commandList);
}else{
my $output = cmdfunction($input);
return($input,$output);
}
}
else I want to handle a scalar command. How do I deal with $parm in the following example:
#Main:
my ($cmd,$parm) CmdListParser($cmd);
if ( $parm is a SCALAR ) {
handle the scalar;
exit;
}
if ( $parm is a HASH ) {
print the hash;
exit;
}
#End-------------------------------------
sub CmdListParser {
my $input = shift;
my %commandList = (
'cmd1' => 'cmd1 description' ,
'cmd2' => 'cmd1 description' ,
'?' => 'Print This Hash' ,
);
if ( $input eq '?' ) {
return($cmd,%commandList);
}else{
my $output = cmdfunction($input);
return($input,$output);
}
}