Help for this page

Select Code to Download


  1. 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 ...
    
  2. 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 ...
    
  3. or download this
    my %stats = (
      'clips'           => 6,
    ...
      'backpacks'       => 1,
      'berserk packs'   => 1,
    );
    
  4. or download this
    my $msgformat = "You have obtained %d %s.\n";
    for my $stat (keys %stats) {
      printf $msgformat, $stats{$stat}, $stat;
    }