On 6 Mar 2007 at 6:08, Jeff Pang wrote: > Is it possible to send an variable (through the env or as an > >argument, or ....) so I can use the variable $dir from the module > >test.pl to set the variable $vardir in param.pl. ?? > > > > Yes you can. > You may declare the vars wanted to be shared in the module as package > variable using Perl's "our" statement. > > $ cat test.pl > use strict; > our ($path1,$path2); > require "param.pl"; > print("path1 $path1\n"); > print("path2 $path2\n"); > > $ cat param.pl > #!/usr/bin/perl > use strict; > my $basepath = "/var/tmp"; > my $vardir = "dir"; > our $path1="$basepath/$vardir/path1"; > our $path2="$basepath/$vardir/path2"; > > 1;
Is the 1; required here? I thought it was only needed in packages. Am I mistaken? Thanx, Dp. > $ perl test.pl > path1 /var/tmp/dir/path1 > path2 /var/tmp/dir/path2 > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/