Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: split but not consumed

by broquaint (Abbot)
on Jul 23, 2004 at 04:28 UTC ( #376790=note: print w/ replies, xml ) Need Help??


in reply to split but not consumed

Use a capture in your regex

print "[$_]\n" for split /(foo)/, 'this foo is foo ... ey'; __output__ [this ] [foo] [ is ] [foo] [ ... ey]
Also, split expects a delimiter then a string (and optionally a limit), so passing the result of one split to another can result in unexpected behaviour. See. the split docs for more info on its usage.
HTH

_________
broquaint


Comment on Re: split but not consumed
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (4)
As of 2016-02-09 00:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How many photographs, souvenirs, artworks, trophies or other decorative objects are displayed in your home?





    Results (292 votes), past polls