On Thursday, April 25, 2002, at 04:58 , Bryan R Harris wrote:

> My guess (this is just an example):
>
> @myarray = (1,2,3,4,5,6,7,8,9,10);
> foreach (@myarray) { if ($_ == 3 || $_ == 5) { undef($_); } }

what you want to look at is

        perldoc -f splice

one way to hack a solution here would be:

http://www.wetware.com/drieux/CS/lang/Perl/Beginners/RemoveFromArrayWithSplice.
txt

The funk that I ran into and did not expect was that my
simplistic first idea is the standard

        while ( $count < $len ) {
                #someJazz with Splice
        }

but that really is not as simple - since well, you
are shrinking the size of the array - so you have
to shrink the $len - and NOT increment the $count,
because now $array[$count] is a Completely new
element you haven't seen before...



ciao
drieux

---


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to