#I have a hash for all the remote hosts my $remotehosts = { "78.example.com" => { user => 'user', host => '0.0.0.78', } "79.example.com" => { user => 'user', host => '0.0.0.79', } } $path = $ARGV[0]; $destination = $ARGV[1]; #the copy scp statement is in a while loop which loops through the keys in the hash. $scp->scp($path, $remote->{user}.'@'.$remote->{host}.":".$destination)