Well, let's look at the code, it's pretty short and simple.
Code:
void Corpse::RemoveItem(int16 lootslot)
{
if (lootslot == 0xFFFF)
return;
ItemList::iterator cur,end;
cur = itemlist.begin();
end = itemlist.end();
for(; cur != end; cur++) {
ServerLootItem_Struct* sitem = *cur;
if (sitem->lootslot == lootslot)
{
RemoveItem(sitem);
return;
}
}
}
Ok, it's looking for the slot number you pass in to match the lootslot on the ServerLootItem. So, let's look where that is assigned.
The only place I can see is Corpse::MakeLootRequestPackets where it is assigned 0xFFFF, and then a few lines later to a sequential value.
That function appears to be called when someone actually clicks on a corpse to loot it which may be later than you run your perl code.
NPC::AddLootDrop seems like a logical place to assign a value to ServerLootItem_Struct::lootslot, but I didn't see anything in there that would do so. ServerLootItem_Struct has no constructor, so what ends up in there by default is probably uninitialized garbage of some sort.
Short answer is I would guess that function isn't all that useful the way it is now. Maybe it should just take an index into the list of items and delete that index which is what it seems you want. Even if the code you're using is in EVENT_LOOT, I'm not sure it's possible to prevent the current item from being looted by deleting it, but that's just my guess.