http://www.perlmonks.org?node_id=1010648


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....

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?