I want to put a hash declaration in a separate file from the main script.
How do I do this correctly?

perl.pl ( main script )

#!/usr/bin/perl
use warnings;
use strict;
use Data::Dumper;

require "lib.pl";

print Dumper \%hash;

lib.pl ( library script )

#!/usr/bin/perl
use warnings;
use strict;

my %hash = (
   "Version" => 0,
   "SRT" => 11,
   "SRFC" => 12,
   "CFC" => 21,
   "CFCQ" => 22,
   "ICell" => 29,
   "ISector" => 30,
   "Cell" => 31,
   "Sector" => 32,
);

1;

The error I am getting:

Global symbol "%hash" requires explicit package name at perl.pl line 8.
Execution of perl.pl aborted due to compilation errors.

Reply via email to