为什么使用require之后,pm文件中不能调用主程序里面的变量?

test.pl
#!/usr/bin/perl -w

use strict;
require "print_time.pm";

our $my_time;
our $my_year;
our $my_day;
our @my_result;
chomp ($my_year = `date +%Y`);
chomp ($my_day = `date +%Y_%m%d`);

print "my result is \n @my_result \n";
print "in main program , \$my_year is $my_year \n";
print "in main program , \$my_day is $my_day \n";

&print_hello;
&print_time::print_time();

sub print_hello {
    print "Hello , world \n";
}


#print_time.pm

package print_time;

use strict;

sub print_time {
    $main::my_time = localtime;

    print "in print_time.pm, my_year is $main::my_year \n";
    print "in print_time.pm, my_day is $main::my_day \n";
    print "print hello in print_time.pm \n";

    &main::print_hello;
}

return 1;


1 package print_time;

2 $main::my_time, $main::my_year, ... , &main::print_hello;


QUOTE:
原帖由 ynchnluiti 于 2008-10-24 22:57 发表
1 package print_time;

2 $main::my_time, $main::my_year, ... , &main::print_hello;

谢谢!