in reply to What is it I don't understand about perl scoping?
I think it's clearer like this. It's nearly the same thing, but it doesn't have the lexical masking that yours has. That just confuses the issue.
use strict; use warnings; foo(); my ($foo, $berries) = (1,2); foo(); sub foo { print "$foo, $berries\n"; }
Here you can clearly see I'm using the foo and berries declared lexically after the function is called. The declaration happens at compile time and the initialization happens at runtime.
-Paul
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: What is it I don't understand about perl scoping?
by brycen (Monk) on Jul 08, 2009 at 20:13 UTC |