in reply to splice help - deleting specific element

grep is the correct command, it just looks like your grep block needs tuning. If the company names are just strings, you ought to be able to use:
@allcompanies = grep { not $_ eq $co } @allcompanies
Notice if there are duplicates, this will whack all of them.

Replies are listed 'Best First'.
Re^2: splice help - deleting specific element
by JavaFan (Canon) on Oct 17, 2008 at 17:15 UTC
    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;
      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.

Re^2: splice help - deleting specific element
by kathys39 (Acolyte) on Oct 17, 2008 at 17:07 UTC
    works like a charm. guess that is why I should always have use warnings on, right? thanks again-