Ok, the first question is how do I remove an element of an array? It can be any element.....
Second: how do I use while on an array?
xXHalfSliceXx,
That will work great for..... javascript arrays.
I would post a suggestion or two but Cosmet is in the habit of not replying to threads he starts.
Sorry, once I get the answer I forget to reply thanks..... Please help!I'll reply this time.
Second, don't use "while" on an array, that is almost never appropriate. Use "for" or "foreach" or "map" or "grep" for processing arrays.Code:my $element = 'cat'; my @array = qw(dog pig cat bird); @array = grep {$_ ne $element} @array; print "@array";
Last edited by xXHalfSliceXx; 03-14-2007 at 05:35 PM.
Thank you for replying - I've been assigning the array values to "", is that good enough for erasing them?
Depends on what you are doing, that just makes the array element an empty string, but the array will still be the same length as before because you did not delete the array element, just defined it as empty. Most likely that is not what you really want to do.
hmmm...another thread abandoned by cosmet, I should have learned my lesson. I have now.![]()
Sorry, I sometimes go for days without getting on the net/computer. I've just now started working on this project again. Thank you for your suggestions, I managed to get them working well in my script.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks