|P is for Practical|
For my attempt once at explaining the error, take a look at RE (3): BrainPain-Help.
It really is a naming issue.
Functions are given global names from which you can reach them from anywhere, any time. But only one can be available from that name at a time anywhere in the program.
Lexical variables (declared with my) are private names that can only be reached by name from certain blocks of executing code. There may be several copies of a given lexical variable in existence at the same time, but because of how the naming works, they won't be mixed up.
Now Perl is being asked to figure out which copy of a lexical variable will be seen when you call the globally named function and is throwing its hands up in disgust.
In reply to Re (tilly) 1: Scoped Variables in a Recursive Function.