See Original text in context
method sibling(IO::Path: Str() --> IO::Path)
Allows to reference a sibling file or directory. Returns a new IO::Path based on the invocant, with the .basename
changed to $sibling
. The $sibling
is allowed to be a multi-part path fragment; see also .add
.
say '.bashrc'.IO.sibling: '.bash_aliases'; # OUTPUT: «.bash_aliases".IO»say '/home/camelia/.bashrc'.IO.sibling: '.bash_aliases';# OUTPUT: «/home/camelia/.bash_aliases".IO»say '/foo/' .IO.sibling: 'bar'; # OUTPUT: «/bar".IO»say '/foo/.'.IO.sibling: 'bar'; # OUTPUT: «/foo/bar".IO»