Just another Perl shrine | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
In general I'd recommend avoiding the pattern while(chomp(<$handle>)) because it often suffers from issues (another explanation). You might also want to consider using a module for prompting.
Or even this (the advantage being ExtUtils::MakeMaker is a core module, even though it has a completely different purpose):
The module does have another advantage: "If prompt() detects that it is not running interactively and there is nothing on STDIN or if the PERL_MM_USE_DEFAULT environment variable is set to true, the $default will be used without prompting. This prevents automated processes from blocking on user input." Update 2020-11-30: See also the more powerful IO::Prompter, simple example here. In reply to Re: Empty STDIN does not exit while loop
by haukex
|
|