Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Split using multiple conditions

by mda2 (Hermit)
on Jun 11, 2005 at 15:09 UTC ( #465808=note: print w/replies, xml ) Need Help??


in reply to Split using multiple conditions

The bart give a great response! But to understand your question... Your split regex need a quantifier:
$_ = 'FDR [62.10060.051-F] [62.10051.381] 0 1 0'; @f1 = split/\s+\[/; #>> split only \s+ AND [ ... @f2 = split/\s+\[?/; #>> split \s+ OR \s+[ ... @f3 = split/\]?\s+\[?/; #>> split parts, without []... print join(" + ", @f1), "\n"; print join(" + ", @f2), "\n"; print join(" + ", @f3), "\n"; __END__ FDR + 62.10060.051-F] + 62.10051.381] 0 1 0 FDR + 62.10060.051-F] + 62.10051.381] + 0 + 1 + 0 FDR + 62.10060.051-F + 62.10051.381 + 0 + 1 + 0

--
Marco Antonio
Rio-PM

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (7)
As of 2019-12-08 21:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?