Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.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
在Perl中,如何在一个路径中获得两级目录?_Perl - Fatal编程技术网

在Perl中,如何在一个路径中获得两级目录?

在Perl中,如何在一个路径中获得两级目录?,perl,Perl,在perl中,如何从一个环境变量向上移动两个目录 sub do_file_tracing { my var = "$ENV{IMPORTANT_DIR}"; } 我想在long/path/to/the/important\u dirlong/path/to/the/important\u dir/../../..//code>创建一个文件,即在long/path/to/使用。例如: use Path::Tiny; my $dir = path($ENV{IMPORTA

在perl中,如何从一个环境变量向上移动两个目录

sub do_file_tracing {
  my var = "$ENV{IMPORTANT_DIR}";

}
我想在
long/path/to/the/important\u dir
long/path/to/the/important\u dir/../../..//code>创建一个文件,即在
long/path/to/
使用。例如:

use Path::Tiny;
my $dir = path($ENV{IMPORTANT_DIR})->parent(2);
my$dir\u qfn=“$ENV{IMPORTANT\u dir}/./”;
请参阅和中的
parent()
方法