in reply to Exporting variables between two perl files
For reasonably recent Perl, you can use the our keyword, which works similar to my but it's not the same, of course. In file1.pl:
In file2.pl:#!/usr/bin/perl use strict; use warnings; our $var = 1;
You get:#!/usr/bin/perl use strict; use warnings; our $var = 10; print "\$var is $var\n"; do "file1.pl"; print "\$var now is $var\n";
For previous versions of Perl, you can obtain similar results with use vars (see http://perldoc.perl.org/vars.html, noting that it is now obsolete).poletti@flaviox ~/sviluppo/perl> perl file2.pl $var is 10 $var now is 1
Flavio
perl -ple'$_=reverse' <<<ti.xittelop@oivalf
|
|---|