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

Re: [MacPerl] Novice question regards subroutines



At 11:00 AM -0700 9/19/1998, PwrSurge wrote:
>>>  if ($MainMenu = "1") {
>>>    &CheckMenu;
>>>  }
>>
>
>I tried using == and the perl script aborted compilation due to errors...
>
>I have always had the train of thought that if you're comparing letters
>(ABC) to (ABC) letters, you need to use the eq; if you're comparing numbers
>(123) to numbers (123) you always use = or ==.  Can somebody clarify that?
>I gathered that from the learning perl and programming perl books.
>
>Thanks.

Correct, but by having the "" around the number 1 perl thinks you want to
compare strings.  do:
if ($MainMenu == 1) {

without "" around the 1, or

if ($MainMenu eq "1") {

with the quotes.

Kevin



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch