in reply to copying directory from other machine to local machine

Can you break this problem apart? Use perl to generate the list of files, then call scp to transfer the files? You should be able to get around the password prompts if you can set up passwordless ssh between the two machines.