Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Here is my question. I dont want t

Status
Not open for further replies.

GeniuS22

MIS
May 25, 2002
29
CA
Please help me.
I dont want to go through this.

$rep=<stdin>; chomp $rep;
$rep=~tr/Yy/1/;
if ($reponse==1) { }

I would like to know how to make the script accept only &quot;Y&quot; as its answer. I've been told perl does not recognize letters. I've heard it can be done by something like this.

EX:

rep=<stdin>; chomp $rep;
&answer unless $rep;
if ($reponse=='0x21') { }

which '0x21' will equal to &quot;Y&quot; (and not &quot;y&quot;)

How can I get a list of that type!
PLEASE HELP ME!! IT WILL BE VERY APPRECIATED
THANKS IN ADVANCE FOR ANY HELP Knowledge is the first step to Greatness!!!
 
Code:
$rep=<stdin>; 
chomp $rep;
if ($rep eq &quot;Y&quot;) {
 # It's the right answer, so do stuff here
} else {
 # Wrong answer, do other stuff here
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top