Ohh ... sorry ... after rethinking over it ... I think it converts the $normal 
to lower case before comparison

Please ignore my mail earlier

Thanks,
Paryushan


-----Original Message-----
From: Sarsamkar, Paryushan [mailto:psars...@ptc.com] 
Sent: Monday, March 02, 2009 6:18 PM
To: beginners@perl.org
Cc: Gunnar Hjalmarsson
Subject: RE: Accepting default value for user input

Ok thanks. But is lc needed here? I tried without using lc it works fine 
because output of comparison will be always 1 if I am not wrong. 

last if lc $normal eq 'yes' or lc $normal eq 'no';

Thanks,
Paryushan


-----Original Message-----
From: Gunnar Hjalmarsson [mailto:nore...@gunnar.cc] 
Sent: Monday, March 02, 2009 5:44 PM
To: beginners@perl.org
Subject: Re: Accepting default value for user input

Sarsamkar, Paryushan wrote:
> I did not understand meaning of this line :( below. I only understood
> that it will exit while loop if the input has either yes or no. But
> then what is " grep { lc $normal eq $_ } "?
> 
> last if grep { lc $normal eq $_ } 'yes', 'no';

It's another way to say:

     last if lc $normal eq 'yes' or lc $normal eq 'no';

http://perldoc.perl.org/functions/grep.html

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to