Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/perl/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在bin文件夹之外的Perl中创建一个目录_Perl - Fatal编程技术网

在bin文件夹之外的Perl中创建一个目录

在bin文件夹之外的Perl中创建一个目录,perl,Perl,我试图用perl创建一个文件夹,但它要么出现在C:\drive中,要么出现在perl脚本所在的文件夹中 use File::Basename; use File::Path qw/make_path/; my $file = "/$tournamentName/files/archive/"; my $dir = dirname($file); make_path($dir); 上面的代码将$tournamentName文件夹放在C:\驱动器中。如何指定文件夹是在bin外部创建的-

我试图用perl创建一个文件夹,但它要么出现在C:\drive中,要么出现在perl脚本所在的文件夹中

 use File::Basename;
 use File::Path qw/make_path/;

 my $file = "/$tournamentName/files/archive/";
 my $dir = dirname($file);
 make_path($dir);
上面的代码将$tournamentName文件夹放在C:\驱动器中。如何指定文件夹是在bin外部创建的-最好是在bin的父文件夹中

谢谢

如果您是指脚本所在的目录

use FindBin qw( $RealBin );

my $dir = "$RealBin/../$tournamentName";
use FindBin qw( $RealBin );

my $dir = "$RealBin/../$tournamentName";