in reply to Using variables declared in a library from other perl scripts
Given a module file nonam1.pm containing:
use strict; use warnings; package noname1; our $wibble = 'Hello World'; 1;
then a Perl source file in the same location containing:
use strict; use warnings; BEGIN { require "./noname1.pm"; } print $noname1::wibble;
prints:
Hello World
as does:
use strict; use warnings; use noname1; print $noname1::wibble;
Update: Remove broken and needless cruft from module code (see anno's reply).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Using variables declared in a library from other perl scripts
by Anno (Deacon) on Apr 19, 2007 at 08:59 UTC | |
by GrandFather (Saint) on Apr 19, 2007 at 19:06 UTC | |
|
Re^2: Using variables declared in a library from other perl scripts
by linuxfan (Beadle) on Apr 19, 2007 at 00:21 UTC |