See if you can get a good Perl book to read about scoping.
There's scope within any set of curly braces {} or
within a single file outside of all curly's (nyuk, nyuk,
nyuk). So you have a set being passed from that outside
scope to the scope inside the function, which is assigning
what's passed to it. The easiest thing, and probably what
you want, is to declare them all with my at the top
of the file in addition to the ones in the sub.
The reason for the two sets of declarations is the same as
for any other programming language: The function is general
purpose so it takes what's passed to it and keeps a copy to
work on for each call (thereby also allowing simultaneous
threaded calls); the outside caller has values it got from
somewhere else that it wants the function to return a result
for.
| [reply] |