Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Removing certain elements from an array

by le (Friar)
on Aug 24, 2000 at 20:58 UTC ( [id://29457]=note: print w/replies, xml ) Need Help??


in reply to Removing certain elements from an array

My solution (clumsy as usual):
my @array = qw( ...); my @remindexes = qw( ... ); my %remindexes; my @newarray; for (@remindexes) { $remindexes{$_}++; } for (my $i = 0; $i <= $#array; $i++) { push @newarray, $array[$i] if !$remindexes{$i}; }
Of course, if you would setup the indexes to remove into a hash from the beginning, you could omit the first step.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://29457]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2024-04-19 10:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found