IIRC put does not take two args, you need to do a cd to $ftp_dest_path($i) first. However I would suggest you look at net::ftp as it will make your life in such code soooo much easier. Have a look on Super search there are lots of nodes showing how to use it.