in reply to Exporting variables between two perl files

Do it with objects.

File1.pl:

use strict; use warnings; use File2; my $file2obj = File2->new(); print "var: " . $file2obj->{var} . "\n"; #should print 1 $file2obj->{var} = 10 . "\n"; print "var: " . $file2obj->{var}; #should print 10

File2.pm:

package File2; use strict; use warnings; use fields qw(var); # to keep yourself from making stupid typos, like +calling $file2obj->{vaar}; sub new { my $package = shift; my $self = fields::new($package); $self->{var}=1; # initialize var; return $self; } 1;

Now for a followup... how would you do that in perl6? ;)