in reply to Array Comparison

To solve your case problem, try this:

use strict; use warnings; my @words = qw ( a ants cats cats dogs DOGS rabbits r@bbits turtles wa +rthogs ); my @exclude = qw ( ants Turtles WARTHOGS ); my %exclude = map { lc $_ => '1' } @exclude; for ( @words ) { next if /\W/ or length $_ < 4 or $exclude{lc $_}++; print "$_\n"; }

dave

Replies are listed 'Best First'.
Re: Re: Array Comparison
by mcogan1966 (Monk) on Dec 23, 2003 at 20:09 UTC
    Actually, @words and @exclude are generated by reading outside sources. I just dropped the lc() right where the data is being read and it works just fine. Thank you for the suggestion though.
      Actually, @words and @exclude are generated by reading outside sources.

      Well, yeah, that's what I assumed. I just added those arrays for testing. I even assumed that you might not have any control over the 'outside sources', which is why I did the lc() stuff in my snippet :-)

      dave