That solved my problem :-)

Thanks for the help I probably put toomuch thought into solving this
simple thing ;-)

/juman

On Tue, Mar 23, 2004 at 01:29:42PM -0600, James Edward Gray II wrote:
> On Mar 23, 2004, at 1:23 PM, juman wrote:
> 
> >Okay thanks :)
> >
> >Here is a code snippet :
> >
> >        if ($nr == $quiz_id{"$quizzer"}) {
> >            $window->print ("Id answer : $reply", MSGLEVEL_NEVER) if
> >($window);
> >            $exit = 0;
> >        } elsif ( '$question' == '$quiz_question{"$quizzer"}' ) {
> >           $window->print ("Quiz answer : $reply", MSGLEVEL_NEVER) if
> >           ($window);
> >           $exit = 0;
> >        }
> >
> >For the moment the two strings is represented as this :
> >
> >'$question' == '$quiz_question{"$quizzer"}'
> >
> >I know this doesn't work and that is what I want to replace with the
> >regexp comparsion...
> 
> I don't think you want a regex solution at all.
> 
> First, '$question' means the string $ q u e s t i o n, minus a few 
> spaces.  I don't think you meant that and I suggest dropping the 
> quotes.
> 
> Second, similar mistake on the other side.  Drop the single quotes.  
> Drop the double quotes over there too, while you're at it.  Don't need 
> them either.
> 
> Finally, == is for comparing numbers.  You want it's cousin eq which 
> compares strings.
> 
> That leaves us with:
> 
> $question eq $quiz_question{$quizzer}
> 
> See if that fixes you up.
> 
> James
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to