gpt4 book ai didi

perl - 我如何移动以 guid 命名的目录?

转载 作者:行者123 更新时间:2023-12-01 06:08:07 25 4
gpt4 key购买 nike

今天,我写了一个perl脚本,如下代码:

my @files = <./{FF35B8A6-985C-4644-87B1-3FE83D1A50B}/*>;
print @files;

但它什么也没输出。当我用诸如 d: 之类的通用路径更改 guid 路径时,它起作用了。为什么? perl 是否支持以 guid 字符串命名的路径?

操作系统:Windows 7 32位
Perl版本:ActivePerl 5.12.3

最佳答案

my @files = <\\{FF35B8A6-985C-4644-87B1-3FE83D1A50B\\}/*>;
print @files;

应该可以。您需要引用特殊字符(此处为 {})。

引用自 File::Glob

On DOSISH systems, backslash is a valid directory separator character. In this case, use of backslash as a quoting character (via GLOB_QUOTE) interferes with the use of backslash as a directory separator. The best (simplest, most portable) solution is to use forward slashes for directory separators, and backslashes for quoting. However, this does not match "normal practice" on these systems. As a concession to user expectation, therefore, backslashes (under GLOB_QUOTE) only quote the glob metacharacters '[', ']', '{', '}', '-', '~', and backslash itself. All other backslashes are passed through unchanged.

关于perl - 我如何移动以 guid 命名的目录?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6520239/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com