use Path::Tiny qw(path); my $path = path('/home/grant/projects/talks/path-tiny/talk.xml'); say $path->basename; # talk.xml say $path->parent; # /home/grant/projects/talks/path-tiny say $path->parent->basename; # path-tiny
use Path::Tiny qw(path); my $path = path('/home/grant/projects/talks/path-tiny/talk.xml'); say $path->basename; # talk.xml say $path->parent; # /home/grant/projects/talks/path-tiny say $path->parent->basename; # path-tiny