I don't think strict does what you think it does. There's no need to pre-declare variables or functions (subs) in Perl. However, strict will complain about you using global variables without explicit package names. All you have to do is use lexically-scoped variables. It does this for very good reasons.

Or, in other words, when you first use a variable, use my:

my $xml = new XML::Simple;

When we advocate use strict;, we do so with good reason and as a result of vast experience. Personally -- I've been screwed over a few times because I was too lazy to work with strict in place. And vicariously -- we've all helped folks solve problems that would have been entirely avoided with the use of strict and warnings.

So please, use strict; use warnings; -- it really will help you learn good Perl more quickly!

<radiant.matrix>
Ramblings and references
The Code that can be seen is not the true Code
I haven't found a problem yet that can't be solved by a well-placed trebuchet

In reply to Re^3: Accessing 2nd level elements in XML::Simple and using the data in an SNMP call by radiantmatrix
in thread Accessing 2nd level elements in XML::Simple and using the data in an SNMP call by wruehl

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.