in reply to Splitting on uppercase letters

$camel_case_string = 'SomeOtherString'; while ($camel_case_string =~ m/([A-Z][a-z]*)/g){ push(@camel_case_words,$1) } print "@camel_case_words";

Update: good point, Anonymous Monk. Changed the '+' to '*'.



($_='kkvvttuubbooppuuiiffssqqffssmmiibbddllffss') =~y~b-v~a-z~s; print

Replies are listed 'Best First'.
Re: Re: Splitting on uppercase letters
by Anonymous Monk on Sep 09, 2003 at 23:04 UTC

    Test: $camel_case_string = 'ThisTooIsAString';

Re: Re: Splitting on uppercase letters
by Anonymous Monk on Sep 13, 2003 at 03:54 UTC

    Why loop when you can just do it in one stop?

    $camel_case_string = 'SomeOtherString'; @camel_case_words = $camel_case_string =~ /([A-Z][a-z]*)/g; print "@camel_case_words";

    You seem to be looping for no reason.

    Anonymously yours,
    Anonymous Monk