http://www.perlmonks.org?node_id=359145

Slight rewrite of EEMimiru's scratchpad:
#!usr/bin/perl use strict; use warnings; #use diagnostics; # let's create a character my %higher_level_struct = ( 'Mimiru'=>{ 'hitpoints'=>10, 'attack' =>5, 'armor' =>2 } ); =head1 BADREUSE my %mimiru = ( "name" => "Mimiru", "hitpoints" => 10, "attack" => 5, "armor" => 2, ); sub score { print "Name: ", $mimiru{"name"}, "\n"; print "Hit Points: ", $mimiru{"hitpoints"}, "\n"; print "Attack Power: ", $mimiru{"attack"}, "\n"; print "Armor Rating: ", $mimiru{"armor"}, "\n"; } =cut sub score { my $whoName = shift @_; my $whoRef = $higher_level_struct{$whoName}; #don't use globals li +ke this print $whoRef->{'hitpoints'}; } # later on a combat system will go here score('Mimiru');