in reply to Multiple STDIN sources

This is a common thing. Various Linux tools do this all the time, so I'm not sure why the "standard" answer wasn't posted within minutes. /dev/tty is an alias for the controlling terminal:
while (<>) { $stream .= $_; } open TTY, "</dev/tty"; print "Do you want to process the stream?"; my $ans = <TTY>;
Alternatively, you can actually read from STDERR, just as you might print status or error messges to STDERR. If your reading inout from stdin, you might want to be able to write output to stdout too, rather than having your prompts go to stdout. You can print your prompts to STDERR or open the tty read/write "+</dev/tty".
~~~~~~~~~~~~~~~
Ray Morris
support@webmastersguide.com

Replies are listed 'Best First'.
Re: Re: Multiple STDIN sources
by perlfan (Parson) on Mar 10, 2004 at 14:27 UTC
    Thank you all ... at some point I need to find a xp solution so it will work on non-*nix, but that is not a concern right now.
      that's easy enough, fortunately. just change the open line from Abigail's code to read:
      if($^O eq 'MSWin32') { open(STDIN, "CON") or die $!; } else { open(STDIN, "/dev/tty") or die $!; }
      cheers,
      Aldo

      King of Laziness, Wizard of Impatience, Lord of Hubris