Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Splitting on uppercase letters

by ajdelore (Pilgrim)
on Sep 09, 2003 at 22:20 UTC ( [id://290194]=note: print w/replies, xml ) Need Help??


in reply to Splitting on uppercase letters

Updated: This solution is pretty lame, and also fails the test case pointed out by Anonymous Monk. Use antirice's solution.

Well, I really doubt that this is the nicest way, but it does use split. (Mind you, it needs a regex substitution first...)

use strict; my @strings = qw (ThisString SomeOtherString); foreach (@strings) { s/([a-z])([A-Z])/"$1:$2"/eg;` my @tokens = split /:/; print join "\n", @tokens; print "\n"; } __END__ # Output: This String Some Other String

</ajdelore>

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (10)
As of 2024-03-28 12:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found