Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: removing elements from an array

by hbm (Hermit)
on Aug 09, 2012 at 17:46 UTC ( #986562=note: print w/ replies, xml ) Need Help??


in reply to removing elements from an array

Might your strings be numeric, or can you simply grep out non-digits?

@array = grep !/\D/, @array;

Otherwise, I'd grab every other like:

my $i; @array = grep ++$i%2, @array;


Comment on Re: removing elements from an array
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (3)
As of 2015-07-05 03:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls