############# # settings.pl %hash1 = ( a => 1, b => 2, ); %hash2 = ( c => 3, d => 4, ); ############# ############# # main.pl #!/usr/bin/perl -w use strict; use Data::Dumper; my %hash1; # declaring them here my %hash2; { local $/; open(my $fh, '<', 'settings.pl') || die "Can't open settings\n"; my $string = <$fh>; eval $string; close $fh; } print Dumper \%hash1; print Dumper \%hash2; ############# shell$ perl main.pl $VAR1 = { 'a' => 1, 'b' => 2 }; $VAR1 = { 'c' => 3, 'd' => 4 };