http://www.perlmonks.org?node_id=867156


in reply to Sending & Executing a perl script on remote machine.

Assuming you have keychain running and have copied your server's id_rsa.pub to every client's authorized_keys file, and your script is already uploaded (executable bit set, and all its dependencies!), then you can just iterate in your favorite scripting language and execute this:
`ssh name@host$num '/path/to/myscript'`
And you will get the script's stdout output back. Now if it has to be a different script over and over, I suspect that can be automated by simply using File::Remote to send the script over first to each host (but remember the executable bit and its required modules).

HTH,
SSF