Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
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
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 musing on the Monastery: (13)
As of 2014-07-24 20:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (167 votes), past polls