$bot->$method(\&GetInput, \&ShowOutput); # In your main program, you have to define sub GetInput{...}, # and sub ShowOutput{...} # Alternatively, use anonymous subs : $bot->$method(sub{print $_[0]; return scalar <>}, sub{print $_[0] . "\n"});