使用use Net::FTP;
Demo:
my $Server = '192.168.1.1';
my $User = 'admin';
my $Password = 'admin';
my $ftp = Net::FTP->new($Server,Passive => 0, Debug => 1,Timeout => 10) or die "Could not connect.\n";
if (defined $ftp)
{
if ($ftp->login($User, $Password) or die "Could not login. \n")
{
$ftp->cwd("config");                   #切换目录
$ftp->put($g_file);                     #上传文件
}
}
$ftp->quit();                                      #退出ftp