use strict; use warnings; my $foo = 5; print "Content-type: text/plain\n"; print "Content-disposition: inline; filename=foo.txt\n\n"; printf "Package: %s\n", __PACKAGE__; printf "[%s] Before: %s\n", $$, $foo; goodness(5); printf "[%s] After: %s\n", $$, $foo; } sub goodness { my $val = shift; printf "[%s] goodness: %s\n", $$, $foo; $foo += $val; #### package Apache::ROOTfoo_2ecom::test_2epl; use Apache qw(exit); sub handler { #line 1 /www/foo.com/test.pl use strict; use warnings; my $foo = 5; print "Content-type: text/plain\n"; print "Content-disposition: inline; filename=foo.txt\n\n"; printf "Package: %s\n", __PACKAGE__; printf "[%s] Before: %s\n", $$, $foo; goodness(5); printf "[%s] After: %s\n", $$, $foo; } sub goodness { my $val = shift; printf "[%s] goodness: %s\n", $$, $foo; $foo += $val; }