Hi,
I have two arrays, for example,
@array = ("john","larry","kevin","peter","mike")
@exclude = ("john","kevin")
i want to delete from @array , values that exist in @exclude.
i.e. i want my @array to look like
@array("","larry","","peter","mike")
i have written this code but it doesnot seem to work.
foreach$i(0..$#exclude)
{
foreach$x(0..$#array)
{
if($array[$x] eq $exclude[$i])
{
delete($array[$x]);
next;
}
}
}
am I missing something? is there someother better way to do it in perl?
thanks
-bd
I have two arrays, for example,
@array = ("john","larry","kevin","peter","mike")
@exclude = ("john","kevin")
i want to delete from @array , values that exist in @exclude.
i.e. i want my @array to look like
@array("","larry","","peter","mike")
i have written this code but it doesnot seem to work.
foreach$i(0..$#exclude)
{
foreach$x(0..$#array)
{
if($array[$x] eq $exclude[$i])
{
delete($array[$x]);
next;
}
}
}
am I missing something? is there someother better way to do it in perl?
thanks
-bd