l*l 发帖数: 26 | 1 【 以下文字转载自 Linux 讨论区 】
发信人: lzl (李作乐), 信区: Linux
标 题: perl: how to get the filename from the full path name
发信站: BBS 未名空间站 (Thu Feb 15 03:04:03 2007), 转信
$full_path_name = /a/b/c/d/filename.txt
How to extract "filename.txt" from $full_path_name
Thanks | a**u 发帖数: 5 | 2 i suggest use split and get the rightmost element | b******n 发帖数: 592 | 3 File::Basename;
then use basename
【在 l*l 的大作中提到】 : 【 以下文字转载自 Linux 讨论区 】 : 发信人: lzl (李作乐), 信区: Linux : 标 题: perl: how to get the filename from the full path name : 发信站: BBS 未名空间站 (Thu Feb 15 03:04:03 2007), 转信 : $full_path_name = /a/b/c/d/filename.txt : How to extract "filename.txt" from $full_path_name : Thanks
|
|