On Mon Mar 02 2009 @ 7:54, Sarsamkar, Paryushan wrote:
> Ohh ... sorry ... after rethinking over it ... I think it converts the
> $normal to lower case before comparison
Right, which is a standard and smart thing to do since you can't count on
your users to correctly type 'y-e-s'. Damn users.
@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'
...@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.
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
Thanks all for your inputs.
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';
Thanks,
Paryushan
-Original Mess