in reply to Parsing an Array of Hashes, Modifying Key/Value Pairs
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})
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)
|
|---|
| 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 |