home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / perl / 8039 < prev    next >
Encoding:
Internet Message Format  |  1993-01-28  |  1.2 KB

  1. Path: sparky!uunet!spool.mu.edu!hri.com!noc.near.net!bigboote.WPI.EDU!bigboote.wpi.edu!john
  2. From: john@sekrit.WPI.EDU (John Stoffel)
  3. Newsgroups: comp.lang.perl
  4. Subject: Re: beginner's split question
  5. Message-ID: <JOHN.93Jan28164901@sekrit.WPI.EDU>
  6. Date: 28 Jan 93 21:49:00 GMT
  7. References: <1k9930INNdcr@life.ai.mit.edu>
  8. Organization: Worcester Polytechnic Institute
  9. Lines: 25
  10. NNTP-Posting-Host: sekrit.wpi.edu
  11. In-reply-to: kenneths@ai.mit.edu's message of 28 Jan 93 18:36:16 GMT
  12.  
  13. >>>>> On 28 Jan 93 18:36:16 GMT, kenneths@ai.mit.edu (Kenneth J. Schneider) said:
  14.  
  15.  
  16. Kenneth> if i want to split $_ into foo, what is wrong with:
  17.  
  18. Kenneth>     $foo = split(/\./, $_);
  19.  
  20. One problem, $foo will have the number of items found with the split.
  21. What I think you want is:
  22.  
  23. @foo = split(/\./o);
  24.  
  25. to print them out on individual lines do:
  26.  
  27. for (@foo) { print "$_\n"; }
  28.  
  29. Randall will now reduce the above line to a one character program.  *grin*
  30.  
  31.                 John
  32.  
  33. --
  34. Youth of today!  Join me in a mass rally for traditional mental attitudes!
  35. -------------------------------------------------------------------------------
  36. john@wpi.wpi.edu | Work Station Specialist | Worcester Polytechnic Institute
  37. John Stoffel     | 508-831-5512 (work)     | Worcester, MA  01609
  38.