in reply to finding the path of the script running as Win service
Anyway:
Your my statement is executed in 2 different stages: the declaration is run at "compile time" (as soon as the compiler sees it), and the assignment is run at "run time".my $foo = 'bar'; BEGIN { print $foo; }
Begin blocks also run at compile time, so the order of execution of the above code would be something like:
This also explains why the code also runs under strict: BEGIN does not have its own namespace and lexical variables don't use namespaces anyway.my $foo; print $foo; $foo = 'bar';
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: finding the path of the script running as Win service
by punkish (Priest) on Jan 05, 2005 at 22:44 UTC | |
by jdalbec (Deacon) on Jan 06, 2005 at 02:08 UTC |