Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Removing elemets from an array

by nithins (Sexton)
on Dec 28, 2012 at 06:38 UTC ( #1010648=note: print w/ replies, xml ) Need Help??


in reply to Removing elemets from an array

#!/usr/bin/perl use strict; my @arcb= (450,625,720,645); my @arca=(625,645); foreach my $a (@arca){ for(my $i=0;$i<scalar(@arcb);$i++){ delete $arcb[$i] if($a==$arcb[$i]); } } print "@arcb";

hope this is what you were looking for....


Comment on Re: Removing elemets from an array
Download Code
Replies are listed 'Best First'.
Re^2: Removing elemets from an array
by doubledecker (Scribe) on Dec 28, 2012 at 06:42 UTC
Re^2: Removing elemets from an array
by rkrish (Acolyte) on Dec 28, 2012 at 06:49 UTC
    Thankyou,it worked for me, I heard that delete should be used only with hash,it might cause some problems when used with arrays. is it true?I can use this?

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (8)
As of 2015-07-31 05:06 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 (274 votes), past polls