Do you know where your variables are? | |
PerlMonks |
STDIN following on?by tfrayner (Curate) |
on Aug 10, 2001 at 22:49 UTC ( [id://103996]=perlquestion: print w/replies, xml ) | Need Help?? |
tfrayner has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
I'm trying to get a script to read a list of files from the command line or accept a list from STDIN (e.g. ls -1 | script.pl):
The script subsequently asks for further input from STDIN (in a separate, unrelated subroutine): The problem is that the second input gets ignored. The script doesn't wait for user input at all. In fact it behaves as though the variable $answer is never initialised. I'm using strict and warnings, and it tells me:
This problem doesn't occur if the flag variable $passhash{stdin} is not set. It looks suspiciously like the problem Sojourner described here, but the solution in that case (use CGI.pm) doesn't seem to apply here (this thing's going nowhere near a web site). I'm sure I'm missing something simple here, but I can't for the life of me figure out what it is. Any help would be greatly appreciated. Thanks.
Back to
Seekers of Perl Wisdom
|
|