while( my ($command, $params) = each %Commands) { # debug("parselocalcommand: Command: $command\n"); if(substr($data, 0, length($command)) eq $command) { my $pattern = $params->{'pattern'}; if(my @res = $data =~ $pattern) { if($#+ == $params->{'function'}[1][1]) { my $answer; if($params->{'function'}[0] eq '') { $answer = &{$params->{'function'}[1][0]}(@res); } else { $answer = modulemethod($params->{'function'}[0], $params->{'function'}[1][0], @res); } if($answer) { printandprompt($answer); last; } } } else { printandprompt("Syntax: #" . $params->{'syntax'} . "\n"); } } }