I'm trying to set up a list of words to ignore in a text.
I tried it like this:

my @ignore = ("U.S.C", "Corp", "Miss", "Conf", "Cong");

and later in a loop

if ( $exists $ignore [$lastWord] ) { next;}

But that tested positive for EVERY $lastWord and skipped every time !
It did the same when I used "defined" instead of "exists".

I finally got it to work with this kludge:

my %ignore = ("U.S.C"=>5, "Corp"=>5, "Miss"=>5, "Conf"=>5, "Cong"=>5);
        if ( $ignore{$lastWord} eq 5) { next;}

Why didn't exists and defined work?

Harvey


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to