If I replaced the <STDIN> with a typical user request, it works fine.
So the problem is getting it to play with STDIN. Now what??
EDIT: Here's a snippet of the code that's not working:
When I run the code with the pipe to more, the message "Enter day number" does not appear. Putting in a number works as usual, and the message does not print until after you hit <ENTER>. The number you enter also never appears on screen. The output correctly gets piped to more.while(1) { print "\nEnter the day number you are interested in: "; chomp($sol_request=<STDIN>); #append 0 to the front if($day_request < 100 && $day_request !~/0[0-9][0-9]/) { $sol_request = "0".$day_request; } if(not -d "/somedir/$day_request/") { print "\nSol $day_request does not exist! Please try again +\n"; } else { last; } }
EDIT2: I guess I didn't quite understand what was going on with the more command. It captures everything going to STDOUT and more's it, right? I don't want that line going to STDOUT. I printed to STDERR instead and now that message shows. The user cannot see what he is typing, though. I could always print out what he typed to STDERR as well, but is a way to show the user what he's typing?
In reply to Re^2: How do I pipe the output of a Perl program to something else?
by azredwing
in thread How do I pipe the output of a Perl program to something else?
by azredwing
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |