home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / perl / 5037 < prev    next >
Encoding:
Internet Message Format  |  1992-07-30  |  1.3 KB

  1. Path: sparky!uunet!ogicse!reed!romulus!merlyn
  2. From: merlyn@romulus.reed.edu (Randal L. Schwartz)
  3. Newsgroups: comp.lang.perl
  4. Subject: Re: Problem with order of precedence, maybe
  5. Message-ID: <MERLYN.92Jul30065305@romulus.reed.edu>
  6. Date: 30 Jul 92 13:53:08 GMT
  7. Article-I.D.: romulus.MERLYN.92Jul30065305
  8. References: <sherman.712450219@foster>
  9. Sender: news@reed.edu (USENET News System)
  10. Organization: Reed College
  11. Lines: 18
  12. In-Reply-To: sherman@unx.sas.com's message of 29 Jul 92 22:50:19 GMT
  13.  
  14. In article <sherman.712450219@foster> sherman@unx.sas.com (Chris Sherman) writes:
  15.    According to the perl book, '&' comes before '!=', so theoretically, what
  16.    numbers between 1-4 get hit should result in the same numbers getting hit
  17.    on the second set of statements.
  18.  
  19. Hmm.  According to *my* copy of the Camel Book (presuming that's the
  20. "perl book" you are talking about), I see "&" at a *lower* precedence
  21. than "!=", so I'd expected "!=" to bind more tightly, and that is in
  22. fact what is happening.
  23.  
  24. I agree, the posted code snippet is incorrect.  Not enough parens.
  25.  
  26. print grep (1 & $_ != 1, split(//, "Just another Perl hacker,")) # odd chars?
  27.  
  28. --
  29. Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
  30. merlyn@reed.edu (guest account) merlyn@ora.com (better for permanent record)
  31. cute quote: "Welcome to Portland, Oregon -- home of the California Raisins!"
  32.