【发布时间】:2011-11-15 13:45:27
【问题描述】:
我在 Perl 程序的两个变量中拥有文件的完整路径和其父目录之一的完整路径。
什么是计算文件相对于父目录的相对路径的安全方法。需要在 windows 和 unix 上工作。
例如
$filePath = "/full/path/to/my/file";
$parentPath = "/full";
$relativePath = ??? # should be "path/to/my/file"
【问题讨论】:
标签: perl