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

Re: [MacPerl] Novice question regards subroutines



At 23:32 -0700 9/20/98, Brian "L." Matthews wrote:
>|#!perl -wl
>|
>|$x = "one plus one";
>|print "yes" if $x = "";
>|print "\$x is $x\n";
>
>where the assignment is still successful, but "yes" isn't printed, because
>when $x is evaluated for the if, it results in the empty string, which is
>a false value.
>
>|# Found = in conditional, should be ==.
>|File 'Untitled'; Line 4
>|$x is
>|
>|What I was expecting was no "Yes", but also no warning.
>
>Why not? There's still an assignment in the conditional.

Indeed...I didn't see the warning when the string assigned to $x was "two",
although I do this morning.  I'm not sure why (I didn't change the #! line
when I changed the string, and I have only one MacPerl
version--5.2.0r4--installed).  [My guess is that I did change the #! line
but don't remember doing it.]

So I wasn't expecting a warning because I didn't know it was there.  Today,
I would expect it.

   --John
--
John Baxter   jwblist@olympus.net      Port Ludlow, WA, USA
Give a man a fish and you feed him for a day.  Teach him to fish,
and you get rid of him for the weekend.

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