Problem #1: Since the "from child" filehandle is non-blocking, the parent could read from the pipe faster than it fills up, causing @files to contain only a partial list. Since the data is coming from the internet, that's actually quite possible. Why did you make it unblockable anyway? Just exit the loop when sftp> is encountered.
Problem #2: You don't empty the pipe attached to sftp's STDOUT once you've done reading file names, so it could fill up and cause sftp to block.
In reply to Re^2: Short example using IPC::Open2 or IPC::Open3
by ikegami
in thread Short example using IPC::Open2 or IPC::Open3
by Limbic~Region
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |