哪位大神来解释下这个 Perl 脚本:
use strict;
use Time::Local;
use Net::FTP;
use Getopt::Long;
use FileHandle;
use POSIX ":sys_wait_h";
use POSIX qw(strftime);
my $year = strftime "%Y",localtime(time-24*3600 );
my $day = strftime "%d",localtime(time-24*3600 );
my $month = strftime "%m",localtime(time-24*3600 );
my $hour = strftime "%H",localtime(time() );
my $min = strftime "%M",localtime(time() );
my $sec = strftime "%S",localtime(time() );
my $date = ($year.$month.$day);
my $cmd;
my $format_cmd;
my $scan_start_time;
my $script_list;
my $usage =<<"EOS";
Usage:$0 -t <scan_start_time>
for: 1.$0 -t "20110419"
-list <script_list>
for: 2.$0 -s "DM_P2PQOE_SE_AREAL3_D DM_P2PQOE_SE_AREAL1_D ..."
EOS
GetOptions(
"t:s" => \$scan_start_time,
"s:s" => \$script_list
);
if (defined $scan_start_time)
{
$date = $scan_start_time;
}
if (defined $script_list) {
my @
script_list_names = split /\s+/, $script_list;
print "@script_list_names\n";
my $data_path = '/root/hadoop/pubdata/';
my $ctl_path = '/root/hadoop/hadoop_cfg/';
my $log_path = '/root/hadoop/hadoop_log/';
foreach my $script (@script_list_names) {
my $file_name = $data_path.$script.'-'.$date;
my $ctl_name = $ctl_path.$script.'.ctl';
my $log_name = $log_path.$script.'.log';
$file_name = `ls $file_name*`;
$format_cmd="perl -pi -e 's/\\\\N//g' $file_name";
system($format_cmd);
$cmd = "sqlldr userid=name/passwd\@ipms direct=true rows=1000000 bindsize=81920000 readsize=81920000 control=$ctl_name data=$file_name log=$log_name";
print $cmd;
system($cmd);
}
}