Re: strange problem with STDIN- need help
- From: "Paul Lalli" <mritty@xxxxxxxxx>
- Date: 29 Dec 2005 02:58:57 -0800
Poonam Pahil wrote:
> Iam using <STDIN> to accept user input but the script just hangs at that
> point.
> I type in the value & program is just stuck at that point.
>
> i know its got to do with buffer flushing. when iam using the same piece of
> code at the beginning of the script everything works fine.
>
> iam using system() a lot. directing input/output to/from files. can this be
> the reason.
No.
Search your code for the $/ variable. I'm betting you changed it at
some point, without localizing the changes. Whereever you changed it,
enclose it's change and the subsequent read(s) in a block, and put the
word 'local' before the change:
{
local $/ = "\n\n";
my $paragraph = <STDIN>;
}
Read about what the $/ variable does in:
perldoc perlvar
> This is the piece of code:
>
> print "Do you want to remove this CSpec(y/n):";
> my $remove_CS = <STDIN>;
> chop($remove_CS);
> if($remove_CS =~ m/n/i )
Try running that piece of code on it's own, and you will see that
nothing there is the problem. The problem lies elsewhere in your code.
Paul Lalli
.
- References:
- strange problem with STDIN- need help
- From: Poonam Pahil
- strange problem with STDIN- need help
- Prev by Date: Re: strange problem with STDIN- need help
- Next by Date: Re: strange problem with STDIN- need help
- Previous by thread: Re: strange problem with STDIN- need help
- Next by thread: Re: strange problem with STDIN- need help
- Index(es):
Relevant Pages
|