in reply to receiving variables from another script
In what fashion doesn't work? Generates an error or warning? Just doesn't do anything? Causes the CPU to overheat then explode?
Because you don't declare $test anywhere in test.pl Perl makes it global to everything. If you use strict the strictures require $test to be declared. If you do that it becomes local. You can use strictures and require by declaring the variable with our:
#!/usr/bin/perl -w #test.pl use strict; use warnings; require 'noname1.pl'; our $test; print $test;
use strict; use warnings; our $test = 'This works!';
Prints:
This works!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: receiving variables from another script
by Anonymous Monk on May 06, 2006 at 21:26 UTC |