use threads; use Net::... my $ssh = ...; $ssh->scp_put($firmware[$antenna_type],'/tmp/fwupdate.bin'); async { print "Upgrading firmware, this will take about 3 minutes.\n"; my $chan = $ssh->channel(); $chan->exec("/sbin/fwupdate -m\n"); $chan->close; }->detach; ...