in reply to Parsing an Array of Hashes, Modifying Key/Value Pairs

> However, I continually get the following, and I don't understand why.
Global symbol "$key" requires explicit package name at ./parse.pl line + 29. Global symbol "$value" requires explicit package name at ./parse.pl li +ne 29.

you forgot my

while (my ($key, $value) = each %{$xmlRef})

edit

For historic reasons package variables ("global symbols") are the default in Perl, lexical variables were introduced later.

Under strict it's necessary to declare explicitly with our or my which kind of variable you want ¹)

This has the advantage over Python's implicit declaration to catch typos more easily.

Cheers Rolf

( addicted to the Perl Programming Language)

update
¹) or to provide an "explicit package name": $package::name works w/o our

Replies are listed 'Best First'.
Re^2: Parsing an Array of Hashes, Modifying Key/Value Pairs
by librarat (Novice) on May 12, 2013 at 21:13 UTC
    Many thanks! This make much more sense now that I'm thinking about it. Strict is fast becoming my best friend :)