http://www.perlmonks.org?node_id=172511


in reply to Getting server share and path from a Microsoft UNC

You can do this manually:
  
my $path = '\\\\Srvbuild\e\ADW61\VENDOR\MICROSOFT\PLATFORMSDK\INCLUDE' +; print join $/, $path =~ /((?:\\[^\\]*){3})(.*)/;
Or better yet, use File::Spec, which is included with Perl:
  
use File::Spec; my $path = '\\\\Srvbuild\e\ADW61\VENDOR\MICROSOFT\PLATFORMSDK\INCLUDE' +; print join $/, File::Spec->splitpath( $path );
   MeowChow                                   
               s aamecha.s a..a\u$&owag.print