in reply to Strange behavior for PUT function in Net::SFTP::Foreign

The first thing I noticed was that there is no closing parenthesis for: $sftp->put(...

I recommend that you add use strict; and use warnings; to the beginning of your code. This will highlight a number of issues.

Unless you actually have an array called @1234 which you wish to interpolate, change the $passwd assignment to use single quotes. In fact, except for the $sftp->put(... arguments, I can't see anywhere that double quotes are required.

-- Ken