Justino Berrun wrote:
> #hello, is there a way to split a string between a digit and character
> #without losing the digit or the character
> #Any help would be very appreciated
>
> $string='hello...4546perl.......2366Pogrammers..3435'; #e.g. would
> make three new strings
>
> @newstrings=split(/(\d)([a-zA-Z])/,$string);        #<--- no success
> here
> print join(":",@newstrings);
>
> #working toward an output like so:
> #hello...4546:perl.......2366:Pogrammers..3435

Hi.

And another way. If you just need the colon-separated string and not
the intermediate array you might as well go straight there.

    ($newstring = $string) =~ s/(\d)([a-zA-Z])/$1:$2/g;

HTH,

Rob






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

Reply via email to