in reply to SCP return code 256

To get the exit code from system() you must decode $?. From perldoc -f system:

if ($? == -1) { print "failed to execute: $!\n"; } elsif ($? & 127) { printf "child died with signal %d, %s coredump\ +n", ($? & 127), ($? & 128) ? ’with’ : ’without +’; } else { printf "child exited with value %d\n", $? >> 8; }

In your case that means scp returned with exit code 1. According to the scp manpage that means it encountered an error, although it doesn't tell you what kind.

-sam