home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!spool.mu.edu!uwm.edu!ogicse!reed!romulus!merlyn
- From: merlyn@ora.com (Randal L. Schwartz)
- Newsgroups: comp.lang.perl
- Subject: Re: Feature request for perl V
- Message-ID: <MERLYN.92Dec16172442@romulus.reed.edu>
- Date: 17 Dec 92 01:24:47 GMT
- Article-I.D.: romulus.MERLYN.92Dec16172442
- References: <62887@mimsy.umd.edu>
- Sender: news@reed.edu (USENET News System)
- Organization: Stonehenge Consulting Services; Portland, Oregon, USA
- Lines: 22
- In-Reply-To: folta@cs.umd.edu's message of 17 Dec 92 00:42:36 GMT
-
- In article <62887@mimsy.umd.edu> folta@cs.umd.edu (Wayne Folta) writes:
- Could grep have an added option/mode that would allow me to get an array
- of indices instead of an array of items? I want to read a file into an
- array, then do some greps in the array, some calculations, and then if
- everything is right, make a couple of changes in the array, then write it
- back out to the file. If I could do this:
-
- @line_numbers = grepi (/IN A/, @lines) ;
-
- I'd be pretty happy. How's it sound?
-
- @line_numbers = grep($lines[$_] =~ /IN A/, $[ .. $#lines);
-
- Be happy.
-
- And stop asking for Perl 5 features! Larry has a full plate as it is!
-
- print grep(!/!/,"Just another Perl hacker,")
- --
- Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
- merlyn@ora.com (semi-permanent) merlyn@reed.edu (for newsreading only)
- factoid: "Portland, Oregon, home of the California Raisins and Lone-Star Beer!"
-