home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / perl / 7504 < prev    next >
Encoding:
Text File  |  1992-12-18  |  940 b   |  30 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: Feature request for perl V
  5. Message-ID: <2B3101AC.34FE@tct.com>
  6. Date: Thu, 17 Dec 1992 22:39:40 GMT
  7. References: <62887@mimsy.umd.edu> <MERLYN.92Dec16172442@romulus.reed.edu>
  8. Organization: TC Telemanagement, Clearwater, FL
  9. Lines: 19
  10.  
  11. According to merlyn@ora.com (Randal L. Schwartz):
  12. >@line_numbers = grep($lines[$_] =~ /IN A/, $[ .. $#lines);
  13.  
  14. Wow.
  15.  
  16. Or if creation of the $[..$#lines array is a problem, perhaps:
  17.  
  18.   @line_numbers = ();
  19.   $i = $[;
  20.   for (@lines) {
  21.     push(@line_numbers, $i) if /IN A/;
  22.     ++$i;
  23.   }
  24.  
  25. -- 
  26. Chip Salzenberg at Teltronics/TCT  <chip@tct.com>, <73717.366@compuserve.com>
  27.   "you make me want to break the laws of time and space / you make me
  28.    want to eat pork / you make me want to staple bagles to my face /
  29.    and remove them with a pitchfork" -- Weird Al Yankovic, "You Make Me"
  30.