package my::data; use strict; use warnings; my $Config ={ # this would be loaded from a config.ini file root => { local => 'c:/local', remote => 'docroot', }, category => { europe => 'europe.html', women => 'women.html', }, }; sub Config{ if (@_ == 4){ $Config->{$_[1]}{$_[2]} = $_[3]; return $_[3]; } elsif (@_ == 3){ if (exists $Config->{$_[1]}{$_[2]}){ return $Config->{$_[1]}{$_[2]}; } else{ return; } } else{ return; } } 1;