Okay, I think
CheeseLord has it cracked. As he
suggests, closing the STDIN filehandle and reopening it on the
/dev/tty (or
/dev/pts/xx or whatever) device from which the script was called works a treat. Thanks very much!
(Update): i.e.
use POSIX;
close(STDIN);
my $tty=POSIX::ctermid();
open(STDIN,"$tty");
Thanks very much!