in reply to scp command in perl introduces extra character while copying

What happens if you chomp the lines read from STDIN?


Improve your skills with Modern Perl: the free book.

Replies are listed 'Best First'.
Re^2: scp command in perl introduces extra character while copying
by surajsam (Initiate) on Nov 09, 2011 at 21:07 UTC

    well it is this line that is causing problem

    system('/usr/bin/scp', "user\@$i:/tmp/zz.txt", "/tmp/zz_$i\.txt"); /tmp/zz_$i.txt becomes /tmp/zz_$i?.txt where $i is a hostname.

      $i is not a hostname. $i is a hostname followed by (at least) a newline. So, please try using chomp on the lines read from STDIN.

        Thanks Monks (chromatic and ikegami). It is missing "chomp" that helped resolve. thanks again.