----- Original Message -----
From: John Pimentel <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, June 12, 2001 1:13 PM
Subject: converting standard input to an upper or lower case
> Hello all:
>
> I am wanting to reduce an "if" from this "or" I list below to "if ($ans eq
> "y")..." by forcing the response to a lower case "y" (like tolower, in C).
> The book I have does show the \l to force the next character to be
> lowercase, but I am still not clear how I pass (in this case a user
> response) to that lower case character.
>
>
> $ans = <> ;
> chomp $ans;
> if ($ans eq "y"||$ans eq "Y") {
>
>
> Anyone got a quick example before I start digging into the sites? I am
sure
> I could do the whole thing more efficiently, but for now I'd like to stick
> with my baby steps. I am trying to understand this stuff.
>
> Thank you all,
>
> John Pimentel
Simplest to use a regex, and make it case insensitive
my $ans=<>;
if ($ans =~ /^y$/i)
{
#code here....
regexp translation:
^ = start
y = y
$ = end
i = case insensitive
this will match 'Y' or 'y' ONLY
HTH
Simon.