in reply to First Time Creating a Package, Am I doing this Right?

Lexicals (declared with my) can't be exported since they don't live in the symbol table. You need to declare it with our or use vars qw( %lists ), or fully qualify the name %Test::Parser::lists = ( ... ).

Replies are listed 'Best First'.
Re^2: First Time Creating a Package, Am I doing this Right?
by Dru (Hermit) on Oct 05, 2004 at 16:16 UTC
    Ah, ok, that was it. Is one way preferred over the other in the community or just personal preference?
      I think it's mostly personal preference. That said our is not avalable in older versions of perl, so if you plan to distribute your code it may be wise to not use it unless you have good reason to. Fully qualifed names get a bit long if you use them more than a few times, especialy if there is more than one in the same statment. Generaly I think use vars is the cleanest and safest way to do it.