Re: strange problem with STDIN- need help




On Thu, 29 Dec 2005, Poonam Pahil wrote:

> if($remove_CS =~ m/n/i ){ ??? }
> it does not reach to this point.
>
> it hangs before this, at
> my $remove_CS = <STDIN>;
>
>


Well this works for me
------------------------cut----------------------------
#!/usr/bin/perl -w

use strict;

print "Do you want to remove this CSpec(y/n):";
my $remove_CS = <STDIN>;
chop($remove_CS);
if($remove_CS =~ m/n/i ){print "\n\n OK - will not remove\n"} else {print
"\n\n OK - will remove\n"}

------------------------cut----------------------------

owen@ubuntu:~/Perlscripts$ perl -c stdin.pl
stdin.pl syntax OK
owen@ubuntu:~/Perlscripts$ perl stdin.pl
Do you want to remove this CSpec(y/n):n


OK - will not remove
owen@ubuntu:~/Perlscripts$ perl stdin.pl
Do you want to remove this CSpec(y/n):y


OK - will remove
owen@ubuntu:~/Perlscripts$





Owen

.



Relevant Pages

  • DBI v. 1.4.1 make test hangs on Solaris
    ... When I run "make test" for DBI v. 1.4.1 it hangs the Sun UNIX machine. ... Perl was a binary obtained from sunfreeware.com ...
    (perl.dbi.users)
  • Re: two way piped open
    ... but this behavior might be caused by Perl buffering your ... > Try selecting your file handle and then setting $| to 1. ... That way Perl ... With just one it hangs... ...
    (perl.beginners)
  • Re: forever loop in IHTMLTxtRange::findText
    ... and a search key is "perl" to make the loop. ... have run into the same bug a number of times. ... IHTMLTxtRange::findText hangs forever with 100% CPU. ...
    (microsoft.public.inetsdk.programming.webbrowser_ctl)
  • DBD::AnyData hangs when exporting XML
    ... Newest DBD::AnyData and AnyData just downloaded from CPAN. ... When export a test database to xml, the script hangs and seems ... it's in a dead loop. ... Is it a bug in Perl? ...
    (comp.lang.perl.misc)
  • perl hangs after receiving signal
    ... I have a script running in perl 5.6.1 on a debian sarge system. ... But I am hoping that someone can offer some help in determining why this hangs and what I might be able to do about it. ...
    (comp.lang.perl.misc)