Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

(MeowChow) Re: split

by MeowChow (Vicar)
on Jun 07, 2002 at 12:58 UTC ( #172511=note: print w/ replies, xml ) Need Help??


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


Comment on (MeowChow) Re: split
Select or Download Code
Replies are listed 'Best First'.
Re: (MeowChow) Re: split
by c-era (Curate) on Jun 07, 2002 at 13:14 UTC
    If you use File::Spec->splitpath, it returns server, path, and filename so you will need to have a third variable for a filename. It will also include the first directory with the server part. Not a big issues, but a couple possible gotchas.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://172511]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (12)
As of 2015-07-31 21:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (282 votes), past polls