Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Trouble splitting pipe delimited

by BillKSmith (Chaplain)
on Nov 05, 2012 at 02:41 UTC ( #1002265=note: print w/ replies, xml ) Need Help??


in reply to Trouble splitting pipe delimited

The module may be needed for more complex cases, but split can handle this one. Note use of negative look behind in the regular expression.

$_ = '1|str|foo\|bar|goo|2323'; $, = ','; print split /(?<!\\)\|/;

Bill


Comment on Re: Trouble splitting pipe delimited
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2014-11-29 03:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (203 votes), past polls