#!/usr/bin/perl
use strict;
use warnings;
my $name = shift;
my $func = "update_$name";
main->$func(); # "main" should be the namespace the functions are in.
sub update_test { print "!test\n" }
sub update_hello { print "hello!\n" }
####
$ perl x.pl test
!test
$ perl x.pl hello
hello!
$ perl x.pl heheh
Can't locate object method "update_heheh" via package "main" at x.pl line 10.
####
#!/usr/bin/perl
use strict;
use warnings;
my $name = shift;
my %updates = (
test => \&update_test,
hello => \&update_hello,
);
$updates{$name}->();
sub update_test { print "!test\n" }
sub update_hello { print "hello!\n" }