I wrote:

$str = '\\server\path';
(undef, $server, $path) = split (/\\/, $str);
print 'Server=', $server, ' Path=', $path;

Peter Vogel wrote:

>That only works in the "path" part doesn't contain "\".
>For example, this is a valid UNC path:
>\\server\share\subdir1\subsubdir1
>Your suggestion would only get server and share.

Yes, you're right, but if I extend the split with an
optional argument like this, it should work...

$str = '\\server\share\dir\subdir\file.ext';
(undef, $server, $path) = split (/\\/, $str, 3);
print 'Server=', $server, ' Path=', $path;

Johannes Studt

-->> FREE Perl CGI scripts add WEB ACCESS to your
-->> POP E-Mail accounts! Download today!! http://www.adjeweb.com

_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to