Hey Guys,

I have a Problem.
I want to remove an element from an array whose index i don't 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

Reply via email to