`ls -ltr /tmp` does not give you a list of files, but a list of files with their attributes and characteristics, while you need the bare file names. Also note that you need a semi-colon at the end of that line;
When you try your scp $output command, you fail to specify the path to $output (/tmp), so that your program is unlikely to find it.
In this line:
you need to escape the @ to prevent Perl from thinking you are trying to manipulate an array called @server. So, something like this:system("scp $output user@server:/tmp/LOGS");
When trying to do such things, I usually find it convenient to build my full command into a variable and to print that variable to check exactly which command I'll issue to the system. Something like this:system("scp $output user\@server:/tmp/LOGS");
my $command = "scp $output user\@server:/tmp/LOGS"; print "Issuing this command: $command\n"; system("$command");
In reply to Re: scp output without having to use "Net::SCP" in Perl
by Laurent_R
in thread scp output without having to use "Net::SCP" in Perl
by pjzero@90
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |