Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

InfiniteSilence's scratchpad

by InfiniteSilence (Curate)
on Jun 02, 2004 at 04:20 UTC ( #359145=scratchpad: print w/ replies, xml ) Need Help??

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');
Log In?

What's my password?
Create A New User
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2016-07-24 11:25 GMT
Find Nodes?
    Voting Booth?
    What is your favorite alternate name for a (specific) keyboard key?

    Results (221 votes). Check out past polls.