Perl_User has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to match all every word from an array except one but am not successful.
my @selected_names = grep(m/.*!todd/, @all_names);
This is not working..any help is appreciated. Thanks.

Replies are listed 'Best First'.
Re: Match all words except one
by broquaint (Abbot) on Jun 17, 2003 at 16:06 UTC
    Just negate the match e.g
    my @selected_names = grep(!/todd/, @all_names);
    Although a comparison might be more appropriate e.g
    my @selected_names = grep { $_ ne 'todd' } @all_names;
    See. perlop for more info.
    HTH

    _________
    broquaint