Hi You might want to take a look at Array::Diff http://search.cpan.org/~typester/Array-Diff-0.04/lib/Array/Diff.pm
Yaron Kahanovitch ----- Original Message ----- From: "Sumit" <[EMAIL PROTECTED]> To: beginners@perl.org Sent: Monday, July 9, 2007 10:43:48 AM (GMT+0200) Auto-Detected Subject: Remove a specific element from an Array Hey Guys, I am a new bie to this Group. I have a Problem. I want to remove an element from an array whose index i dont know. -------------------------------------------------------------------------------------------------- #!/usr/bin/perl -w use strict; my @updateNames = (); my @tempArr = (); my $item = ""; my $item2 = ""; push @updateNames,"I_love_you"; push @updateNames,"I_love_you_too"; push @updateNames,"I_hate_you"; push @tempArr,"I_love_you"; push @tempArr,"I_love_Him"; push @tempArr,"I_hate_you"; foreach $item (@updateNames) { foreach $item2 (@tempArr) { if ($item eq $item2) { pop @updateNames,$item; #This pop is just removing the last element i want to remove $item2 from @updateNames } } } print "\n"; foreach $item (@updateNames) { print $item; print "\n"; } -------------------------------------------------------------------------------------------------- Can somebody help me on this? -- Sumit -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/