in reply to Re: Creating hashes into a module.
in thread Creating hashes into a module.

Fixed, but it doesn't work as I need :-( How can I access from the script to the hash %some_words created in the module?
Res publica non dominetur.

Replies are listed 'Best First'.
Re: Re: Re: Creating hashes into a module.
by borisz (Canon) on Feb 20, 2004 at 11:52 UTC
    If you like to export all into the callers namespace put
    @EXPORT = qw (loadwords %some_words);
    into your module code. But this is not a good idea. what about returning a reference to the new created %somewords?
    sub loadwords { my @words = qw(a able about above across actually after again all) +; my %some_words; foreach (@words) { $some_words{$_} = "1"; } return \%some_words; }
    Boris

      I like this solution. I think I'm gonna use references to the hash.

      Thank you everybody.

      Res publica non dominetur.