Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!harless From: harless@sdd.hp.com (Mike Harless) Newsgroups: comp.lang.perl Subject: I'm lazy, can this be done somehow??? Message-ID: <1991Jan26.012646.4937@sdd.hp.com> Date: 26 Jan 91 01:26:46 GMT Sender: news@sdd.hp.com (Usenet News) Distribution: na Organization: Hewlett-Packard, San Diego Division Lines: 22 Nntp-Posting-Host: hpsdly.sdd.hp.com What I'd like to do is suck up a file into an array, read another file to see how many lines I've already read (if any), and then grep strings out of what's new. The file of lines may have been zero'd out since the last time I read it, so I can't just start reading after skipping so many lines. For example, if I've read a file into the array @lines, and then found out that I've already looked at the first 400 lines last time I ran, I'd like to do something like: $[ = 400 ; @found = grep(/whatever/, @lines) ; and only have grep work on the lines after the first 400. I know that I could do this by using an index into @lines, but was trying to do things elegantly. I've heard rumors that using indices into arrays isn't the perl way! :-) Is there something simple that I missed? ...Mike