Hello fellow Monks, I have a few questions. I am very new to Perl scripting, and I need some help with use strict; Whenever I declare use strict; at the beginning of the script, perl spits out an error where a bunch of variables are wrong. I double, triple, and quadruple checked that all of my variables are declared with 'my', but it keeps giving me that error. I am also facing an organization dilemma. As you can see, this script is very badly set up, but is there any other way to process this data?
print "#---------mRFLoYDFrEAK42's---------#\n"; print "| DOOM Log Parser |\n"; print "#----------------------------------#\n\n"; if (defined $savegame) { print "Game saved $savegame times.\n\n"; } if (defined $deathcnt) { print "Died $deathcnt times.\n\n"; } if (defined $clipsobt) { print "You have obtained $clipsobt clips.\n"; + } if (defined $ammbxobt) { print "You have obtained $ammbxobt boxes of a +mmo.\n"; } if (defined $shelsobt) { print "You have obtained $shelsobt shells.\n" +; } if (defined $shlbxobt) { print "You have obtained $shlbxobt boxes of s +hells.\n"; } print "-------------------------------------\n"; if (defined $shotgobt) { print "You have obtained $shotgobt shotguns.\ +n"; } print "-------------------------------------\n"; if (defined $armorobt) { print "You have obtained $armorobt Armors.\n" +; } if (defined $megarobt) { print "You have obtained $megarobt MegaArmors +.\n"; } if (defined $armboobt) { print "You have obtained $armboobt armor bonu +ses.\n"; } if (defined $helboobt) { print "You have obtained $helboobt health bon +uses.\n"; } if (defined $medikobt) { print "You have obtained $medikobt medikits.\ +n"; } if (defined $stipkobt) { print "You have obtained $stipkobt stimpacks. +\n"; } print "-------------------------------------\n"; if (defined $redkcobt) { print "You have obtained $redkcobt red keycar +ds.\n"; } if (defined $blukcobt) { print "You have obtained $blukcobt blue keyca +rds.\n"; } if (defined $yelkcobt) { print "You have obtained $yelkcobt yellow key +cards.\n"; } print "-------------------------------------\n"; if (defined $backpobt) { print "You have obtained $backpobt backpacks. +\n"; } if (defined $besrkobt) { print "You have obtained $besrkobt berserk pa +cks.\n"; } print "-------------------------------------\n"; if (defined $secrtobt) { print "You have discovered $secrtobt secrets. +\n"; }

In reply to help with "use strict" and code organization by MrFloydFreak42

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.