in reply to Re: splice help - deleting specific element
in thread splice help - deleting specific element

While not $_ eq $co isn't incorrect, I rather write $_ ne $co.
Notice if there are duplicates, this will whack all of them.
That's easily solved:
my $i = 0; @allcompanies = grep {$_ ne $co or $i++} @allcompanies;

Replies are listed 'Best First'.
Re^3: splice help - deleting specific element
by mpeever (Friar) on Oct 17, 2008 at 20:43 UTC
    While not $_ eq $co isn't incorrect, I rather write $_ ne $co.

    I like yours better too.

    About duplicates: I assume whacking dups is actually what was intended based on the problem description, but I thought it would be worthwhile to mention that side-effect.