Reputation: 19
I have this value stored in a string
"-rw-rw-r-- 1 xyz test 3.7K Mar 25 14:59 abcd.txt".
And i just want to trim the "abcd.txt"
part from the string into another.
NB - rest of the part is not constant.
Upvotes: 0
Views: 59
Reputation: 50647
my ($trimmed) = $string =~ /(\S+)$/;
although you might be better with using ie. glob("*txt")
rather than fiddling with external ls
.
Upvotes: 2