in reply to defunct process are WAY beyond my experienc

In preparation of trying to suggest a replacement for your switch use i would like to start with this comment

$t[++$#t]=threads->new(\&adminpass); seems to be a real verbose way of saying push @t,threads->new(\&adminpass);

It looks like your use of switch is to process a comma separated list of commands. a simple replacement for

switch($action) { case /adminpass(,|$)/ { print "Do adminpass ($hostname)\n" if($verbose || $debug); $t[++$#t]=threads->new(\&adminpass); next; } # end case /adminpass/ case /backup(,|$)/ { print "Do backup ($hostname)\n" if($verbose || $debug); $t[++$#t]=threads->new(\&backup); next; } # end case /backup/ case /buildhosts(,|$)/ { print "Do buildhosts ($hostname)\n" if($verbose || $debug); $t[++$#t]=threads->new(\&buildhosts); next; } # end case /buildhosts/ case /buildhostsdell(,|$)/ { print "Do buildhostsdell ($hostname)\n" if($verbose || $debug +); $t[++$#t]=threads->new(\&buildhostsdell); next; } # end case /buildhostsdell/ ... }
might be
if ($action=~/adminpass(,|$)/) { print "Do adminpass ($hostname)\n" if($verbose || $debug); push @t,threads->new(\&adminpass); } # end case /adminpass/ if ($action=~/backup(,|$)/) { print "Do backup ($hostname)\n" if($verbose || $debug); push @t,threads->new(\&backup); } # end case /backup/ if ($action=~/buildhosts(,|$)/) { print "Do buildhosts ($hostname)\n" if($verbose || $debug); push @t,threads->new(\&buildhosts); } # end case /buildhosts/ if ($action=~/buildhostsdell(,|$)/) { print "Do buildhostsdell ($hostname)\n" if($verbose || $debug +); push @t,threads->new(\&buildhostsdell); } # end case /buildhostsdell/ ...
but a more efficient and direct solution may be as follows
# 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"; } }