There may be a solution using split, but I am much more familiar with
regular expressions, so I crafted the following:

use strict;
use warnings;

my $str = "UaBitEssdSi";
my @dpt = ();

while ($str =~ /([A-Z][a-z]*)/g) {
    push @dpt,($1);
}

foreach my $i (0..$#dpt) {
    print "\$dpt[$i]=$dpt[$i]\n";
}

-----Original Message-----
From: Tim Musson [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 20, 2002 6:48 PM
To: [EMAIL PROTECTED]
Subject: How to split on case boundries?


Hey all,

My current source looks like this
   ua_bit_essd_si
I split on _ into @dpt.

The people who control the data want to remove the _ chars and make
the delimiter based on the case of the chars (first char of each part
is uc, all others are lc)...
So the source would look like this
   UaBitEssdSi
I still need to put the same elements into @dpt, so
$dpt[0]=Ua
$dpt[1]=Bit
$dpt[2]=Essd
$dpt[3]=Si
After I get the data into the array, I will change the case.

Last note, the different parts are *not* consistent in length, and
*not* the same number... :-(

--
[EMAIL PROTECTED]
Using The Bat! eMail v1.53d
Windows NT 5.0.2195 (Service Pack 1)
Junk: stuff we throw away. Stuff: junk we keep.


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to