utku has asked for the wisdom of the Perl Monks concerning the following question:
Both file include following:dir_one/my_package.pm dir_two/my_package.pm
The hashes have the same name in each package but their content is different. Now I want to load both packages during runtime, process the hashes in each and so forth. I have done following:##! /usr/local/bin/perl package my_package; require(Exporter); @ISA = qw(Exporter); @EXPORT = qw( %my_hash ); %my_hash = ( ... );
Perl interpreter tells me that the syntax of "require" is wrong:#!/usr/bin/perl -w use Data::Dumper; require dir_one::my_package q( %my_hash ); print "%s\n", Dumper(\%my_hash); require dir_two::my_package q( %my_hash ); print "%s\n", Dumper(\%my_hash);
Where is my mistake? How can access the hashes in this way during runtime?syntax error at ./my_script.pl line 7, near "require dir_one::my_packa +ge qw( %my_hash )" Execution of ./my_script.pl aborted due to compilation errors.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: access to hashes with same name, from different packages with same name
by Joost (Canon) on Feb 11, 2007 at 02:03 UTC | |
|
Re: access to hashes with same name, from different packages with same name
by Anonymous Monk on Feb 11, 2007 at 11:25 UTC | |
by utku (Acolyte) on Feb 11, 2007 at 14:56 UTC | |
by almut (Canon) on Feb 11, 2007 at 16:01 UTC | |
by utku (Acolyte) on Feb 11, 2007 at 16:20 UTC | |
by almut (Canon) on Feb 11, 2007 at 16:25 UTC | |
|