On 12/16/05, John W. Krahn <[EMAIL PROTECTED]> wrote:
> Kevin Old wrote:
> > On 12/16/05, John W. Krahn <[EMAIL PROTECTED]> wrote:
> >>Kevin Old wrote:
> >>
> >>>I'm trying to define a constant hash and have the following:
> >>>
> >>>use constant STOPWORDS => map { lc $_ , 1 } qw(a about above across adj 
> >>>after);
> >>>
> >>>I do not get a hash from this.
> >>You are defining STOPWORDS as a list.
> >
> > What is the correct way to define STOPWORDS as a hash?
>
> You can't because perl implements constants using subroutines and subroutines
> can only return a list.

So to achieve an anonymous hash I'd have to do the following, correct?

use constant STOPWORDS => {
                          'a' => 1,
                          'about' => 1,
                          'above' => 1,
                          'across' => 1,
                          'adj' => 1,
                          'after' => 1,
};

Thanks for your help,

Kevin
--
Kevin Old
[EMAIL PROTECTED]

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


Reply via email to