home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / perl / 7424 < prev    next >
Encoding:
Text File  |  1992-12-14  |  1.0 KB  |  26 lines

  1. Newsgroups: comp.lang.perl
  2. Path: sparky!uunet!sybus.sybus.com!myrddin!tct!chip
  3. From: chip@tct.com (Chip Salzenberg)
  4. Subject: Re: grep() vs. for(;;){} (was Re: In 5.0...)
  5. Message-ID: <2B2D238A.35CE@tct.com>
  6. Date: Tue, 15 Dec 1992 00:15:05 GMT
  7. References: <1992Dec14.043835.23009@reed.edu> <1992Dec14.161234.21332@news.eng.convex.com>
  8. Organization: TC Telemanagement, Clearwater, FL
  9. Lines: 15
  10.  
  11. According to tchrist@convex.COM (Tom Christiansen):
  12. >Usually grep works like mapcar; you could this:
  13. >
  14. >    grep (push(@retlist, /(\d+)/g), "asdf 23fjk4", "qwerty", "123 ")
  15.  
  16. No, no... don't use grep in this case!  It's just going to build a
  17. return value that you'll never use.  Better in every way is:
  18.  
  19.      for ("asdf 23fjk4", "qwerty", "123 ") { push(@retlist, /(\d+)/g); }
  20.  
  21. -- 
  22. Chip Salzenberg at Teltronics/TCT  <chip@tct.com>, <73717.366@compuserve.com>
  23.   "you make me want to break the laws of time and space / you make me
  24.    want to eat pork / you make me want to staple bagles to my face /
  25.    and remove them with a pitchfork" -- Weird Al Yankovic, "You Make Me"
  26.