perl调用perl文件可以使用两种方法:
1.require "xxx.pl";
2.use xxx.pm;
加入require或者use在perl中相当于将文件xxx.pl/pm整个文件都添加到调用它的文件中;
例如:
gettime.pl
#!/usr/bin/perl
print "gettime is 2011-07-25 14:40:10\n";
showtime.pl
#!/usr/bin/perl
require "gettime.pl";
print "get time ok\n";
则执行showtime.pl会显示:
gettime is 2011-07-25 14:40:10
get time ok