我使用的File::Spec模块,像这样
my $volume = 'C';
my $path = File::Spec->catpath(
$volume,
File::Spec->catdir('panel', 'texts'),
'file'
);
print $path;
Run Code Online (Sandbox Code Playgroud)
Cpanel\texts\file
Run Code Online (Sandbox Code Playgroud)
如何在Perl中构建与OS无关的文件路径中File::Spec讨论的可移植模块如何?如果我必须写音量C:\而不只是C为了正确吗?