in reply to Get every nth element
This is kind of cool. You are right, grep is probably under used. I also like the use of pre-increment which will, as a bit of perl magic, initialize $i for you. (actually so will post increment but as it turns out, aside from the offset issue here, preincrement is generally more efficiant for the compiler).#For every $n element in @List grep {not ++$i % $n} @List;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: RE: Get every nth element
by mdillon (Priest) on May 08, 2000 at 20:01 UTC |