- or download this
use strict;
use warnings;
...
... then initialize the rest of your vars ...
... read the log file and accumulate the counts for each variable ...
- or download this
my $msgformat = "You have obtained %d %s.\n";
if ($shotgobt) { printf $msgformat, $shotgobt, "shotguns") };
if ($armorobt) { printf $msgformat, $armorobt, "Armors") };
... do the same type of thing for the rest of the messages ...
- or download this
my %stats = (
'clips' => 6,
...
'backpacks' => 1,
'berserk packs' => 1,
);
- or download this
my $msgformat = "You have obtained %d %s.\n";
for my $stat (keys %stats) {
printf $msgformat, $stats{$stat}, $stat;
}