> need to check if IO.volume is defined Forgot to mention: .volume is always defined; it's just an empty string on systems/paths without a volume. Also, .volume, .basename, and .dirname are all available in a Map from the .parts method, so alternative way to write what you wanted could be:
E:\>perl6 -e "my $path = 'c:\foo\bar\file.txt'.IO; $path.parts<volume dirname>.join.say" c:\foo\bar But if .parent does the job, then use that :)