in reply to Re^2: error:Global symbol "$stopwords" requires explicit package
in thread error:Global symbol "$stopwords" requires explicit package

I already did:

open( LIST, "stopwords.txt" ) or die "$!"; my @stopwords = <LIST>; chomp(@stopwords); # <- was missing my %stopwords; # Create an element in the hash for each stop word. undef @stopwords{@stopwords};

or using less memory:

# Create an element in the hash for each stop word. my %stopwords; open( LIST, "stopwords.txt" ) or die "$!"; while (<LIST>) { chomp; undef $stopwords{$_}; }

Update: Added chomp.

Replies are listed 'Best First'.
Re^4: error:Global symbol "$stopwords" requires explicit package
by zulqernain (Novice) on Jun 01, 2005 at 14:58 UTC
    now it sgiving me same error for
    my %stopwords;