in reply to Hash Question
You want to create a module. You'll probably want to read perlmod first. Here's a very basic example to get you started (untested):
############################ # filename: MyFirstModule.pm package MyFirstModule; our %common_codes_hash = ( '000001' => 'ITEM _First', '000002' => 'Item B', '000003' => 'House', # ....); 1; __END__ ######################## # filename: myscript1.pl use MyFirstModule; my $whatever = $MyFirstModule::common_codes_hash{$foo}; # .... __END__
Later, you can get fancy by using Exporter to export your common data structures or functions into the script's namespace, and other things.
Update: changed the my to our (realized the error at the same time as snowcrash).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Hash Question
by snowcrash (Friar) on Feb 17, 2004 at 15:47 UTC | |
|
Re: Re: Hash Question
by Taulmarill (Deacon) on Feb 17, 2004 at 15:36 UTC | |
by Anonymous Monk on Feb 18, 2004 at 03:09 UTC |