in reply to Re^2: Accessing 2nd level elements in XML::Simple and using the data in an SNMP call
in thread Accessing 2nd level elements in XML::Simple and using the data in an SNMP call
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!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Accessing 2nd level elements in XML::Simple and using the data in an SNMP call
by wruehl (Acolyte) on Jul 31, 2007 at 17:03 UTC |