1
我正在使用以下脚本通过http和实用程序方法下载文件以获取当前日期。Perl将文件名添加日期/时间
use File::Fetch;
use DateTime qw();
sub getDateUtility{
return DateTime->now->strftime('%m/%d/%Y')
}
sub fetchFile{
my $fileHandler = File::Fetch->new(uri => 'http://sample.com/file2fetch.txt');
my $placeFile = $fileHandler->fetch() or die $fileHandler->error;
}
现在我想保存文件的当前日期作为文件的名称。如何在上面的代码中用当前日期替换文件名?