This would be the line of code you are looking for,
my ($network, $path) = split (/(?<!\\)\\(?!\\)/, $include, 2);
Here is how it works:
The regex consists of three tokens, the first token
(?<!\\) is a zero width negative look behind. It makes sure that we don't have a backslash before our matching pattern, but it doesn't match it. Next we have
\\ which matches a \. Finally there is
(?!\\) and that does a zero width look ahead. Like the look behind, it makes sure we don't have a backslash following our pattern, but it doesn't match against it.
The 2 at the end of the split tells split to return a max of 2 elements (network and path). If this wasn't set, then we would split on every '\' (but we wouldn't split on '\\').
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.