In IO::Path§

See primary documentation in context for method relative

method relative(IO::Path:D: $base = $*CWD --> Str)

Returns a new Str object with the path relative to the $base. If $base is not provided, $*CWD is used in its place. If the invocant is not an absolute path, it's first made to be absolute using the .CWD attribute the object was created with, and then is made relative to $base.