method sibling

Documentation for method sibling assembled from the following types:

class IO::Path

From IO::Path

(IO::Path) method sibling

Defined as:

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