[英]How can i remove a specific part of a variable value using perl
we have a variable values value is: /abc/cde/efg/sanj/Sent//abc/cde/efg/sanj/sample sample1.pdf我们有一个变量值是:/abc/cde/efg/sanj/Sent//abc/cde/efg/sanj/sample sample1.pdf
I want to remove the middle part of this value '/abc/cde/efg/sanj/'.我想删除这个值'/abc/cde/efg/sanj/'的中间部分。 Is it possible to remove this part.
能不能去掉这部分。
Since we're talking paths,既然我们在谈论路径,
use Path::Tiny qw( path );
my $qfn = '/abc/cde/efg/sanj/Sent//abc/cde/efg/sanj/sample sample1.pdf';
my $base_qfn = '/abc/cde/efg/sanj';
say path($qfn)->relative($base_qfn);
Output: Output:
Sent/abc/cde/efg/sanj/sample sample1.pdf
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.