home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / perl / 5678 < prev    next >
Encoding:
Text File  |  1992-09-02  |  1.5 KB  |  41 lines

  1. Newsgroups: comp.lang.perl
  2. Path: sparky!uunet!haven.umd.edu!darwin.sura.net!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!convex!convex!tchrist
  3. From: Tom Christiansen <tchrist@convex.COM>
  4. Subject: Re: nuther perl-idiom question..
  5. Originator: tchrist@pixel.convex.com
  6. Sender: usenet@news.eng.convex.com (news access account)
  7. Message-ID: <1992Sep2.141142.14599@news.eng.convex.com>
  8. Date: Wed, 2 Sep 1992 14:11:42 GMT
  9. Reply-To: tchrist@convex.COM (Tom Christiansen)
  10. References: <Btx90n.BMG@unx.sas.com> <1992Sep1.232723.5911@news.eng.convex.com> <1992Sep2.001759.7304@cs.ubc.ca>
  11. Nntp-Posting-Host: pixel.convex.com
  12. Organization: Convex Computer Corporation, Colorado Springs, CO
  13. X-Disclaimer: This message was written by a user at CONVEX Computer
  14.               Corp. The opinions expressed are those of the user and
  15.               not necessarily those of CONVEX.
  16. Lines: 23
  17.  
  18. From the keyboard of dhami@cs.ubc.ca (Mandeep S Dhami):
  19. :>In Perl, one often writes:
  20. :>    $x = $foo || "default";
  21. :As long as you can be assured that $foo is not the string "0"!
  22.  
  23. Yes, well, I consider that false, as are defined nulls.  
  24. I think as long as you're aware that it works this way,
  25. it's ok.
  26.  
  27. How often do you say
  28.  
  29.     while (defined($_ = <>)) {
  30.     
  31.     } 
  32.  
  33. which you technically should lest the last line be a lone zero?
  34.  
  35. --tom
  36. -- 
  37.     Tom Christiansen      tchrist@convex.com      convex!tchrist
  38.  
  39.     You want it in one line?  Does it have to fit in 80 columns?   :-)
  40.                     --Larry Wall in <7349@jpl-devvax.JPL.NASA.GOV>
  41.