in reply to Re^2: sending variables between .pl over remote machines
in thread sending variables between .pl over remote machines

A few more details would help, but I'm assuming your local script has something along the lines of `ssh $remote_host $cmd`;, if so, then modifying this to read my $out = `ssh $remote_host $cmd`;` will capture STDOUT, from the remote host, into $out.

Subsequently, assuming a hash was dumped at the remote host, eval $out;die $@ if $@; should create $VAR1 as a hash ref. locally.

A user level that continues to overstate my experience :-))

Replies are listed 'Best First'.
Re^4: sending variables between .pl over remote machines
by steelcarn99 (Initiate) on Aug 11, 2009 at 14:19 UTC
    I set this line to a variable like you stated above, however I am not dumping any hash. I thought that printing the $out variable would return the same value as the system command.

    my $out = system('ssh $host $cmd'); print $out;

      examine Bloodnook's advice again ` is not the same as ' and you don't need system when using backticks and while we're at it, have a look at Net::SSH::Perl and see if that would make your life easier.
      Further to brother Utilitarians post (& the useful, pertinent stuff therein), the thing you ought to do as a matter of importance is to read system - had you done so, you would now know that the return value from system is not the STDOUT/STDERR from the call, but rather a 16 bit number comprising the return code from the sub-process created and signal number with which the subprocess terminated.

      A user level that continues to overstate my experience :-))