in reply to Re: Splice not working or is it me?
in thread Splice not working or is it me?
That way you only increment if a match wasn't found.$x = 0; while ($x < @array) { # NOT <=, but < if ($array[$x] =~ /$regex/) { splice @array, $x, 1 } else { ++$x } }
_____________________________________________________
Jeff[japhy]Pinyan:
Perl,
regex,
and perl
hacker, who'd like a job (NYC-area)
s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Splice not working or is it me?
by neilwatson (Priest) on Sep 14, 2002 at 16:49 UTC |