in reply to BEGIN { } block
now after having initialized $text you can use it in code that calls foo codepackage foo; BEGIN{ $text = "Hello\n"; } sub subroutine {print $text} return 1;
Other features of BEGIN{}:require foo; foo::subroutine(); #will print Hello
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: BEGIN { } block
by JadeNB (Chaplain) on Aug 07, 2009 at 16:34 UTC | |
by biohisham (Priest) on Aug 07, 2009 at 16:55 UTC |