Documentation for method sibling

Documentation for method sibling, assembled from the following types:

class IO::Path

From IO::Path

(IO::Path) method sibling

method sibling(IO::Path:D: Str() $sibling --> IO::Path:D)

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, although # .add is a better choice for such use.

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␤»