[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] newbie questions about Macperl



On Sat, Nov 20, 1999 at 08:42:02PM -0800, Phil Calvert wrote:
> Hi List, I've got some newbie questions.
> 
> 
> I've been working my way through the "learning perl" book using macperl and
> have typed in an example in the 1st chapter; here it is.

I don't have Learning Perl.  Is the code you posted directly from the book?


> 	elsif (($words{$somename} || "duck" ) eq $someguess) {

> My 1st question is, If I enter "fred" for the  name and "camel" for the guess
> everthing is ok, when I enter a name that is not on in the wordslist and
> "duck" for the guess everthing works *but* when I enter "fred" as the name
> and "duck" as the guess the script still won't let me out of the while
> loop. Why is that?

The secret word for "fred" is "camel", not "duck".  The word "duck" is used
as a user's secret word only when that user doesn't already have a secret
word.


Compare:

($words{$somename} || "duck" ) eq $someguess

($words{$somename} eq $someguess) || ("duck" eq $someguess)


Ronald

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org