in reply to including another perl file
The only way to literally include a file is to eval its contents:
Use require and use only with modules (those .pm thingies that have their own packages), because require only loads once and this WILL bite in any persistent environment.eval do { local $/ open my $fh, '<', 'B.pl' or die $!; readline $fh; } +;
do FILENAME is great, but many people expect lexicals to be shared, so I only recommend eval STRING for file inclusion now. In my mind, there are two ways of programming with multiple files:
Juerd # { site => 'juerd.nl', plp_site => 'plp.juerd.nl', do_not_use => 'spamtrap' }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: including another perl file (dynamic scoping)
by Aristotle (Chancellor) on Jun 02, 2003 at 21:27 UTC | |
by Juerd (Abbot) on Jun 03, 2003 at 05:28 UTC |