# create a list of the command names and the subroutines they call my %cmds=(adminpass =>\&adminpass, backup =>\&backup, buildhosts =>\&buildhosts, buildhostsdell =>\&buildhostsdell ); # break list of comma sep commands into words # and if we have a subroutine for that word start a thread with it for my $cmd (split(',',$action)) { if (exists $cmds{$cmd}) { print "Do $cmd ($hostname)\n" if($verbose || $debug); push @t,threads->new($cmds{$cmd}); } else { print "Command $cmd unknown\n"; } }