There is the example from the Camel book for putting in commas,

1 while s/(\d)(\d\d\d)(?!\d)/$1,$2/;

which can easily be modified from three and comma, to two and a space:

1 while s/(\d)(\d\d)(?!\d)/$1 $2/;

Which also leaves odd ones on the left. The previous solution put them on 
the right.

So now:

You can substitute anything you want, with any number you want, and put the 
odd ones on either side you want. Ain't we cool :)

ms





At 14:22 6/10/02 +0000, you wrote:
>On Mon, 10 Jun 2002 09:10:05
>  Joseph Youngquist wrote:
> >This worked for me,
> >$a = 12345678904539;
> >@numbers = split(/(\d{2})/, $a);
> >$NewA = join(' ', @numbers);
> >print "\nNew A: $NewA";
>  <snip>
> >-----Original Message-----
> >From: [EMAIL PROTECTED]
> >[mailto:[EMAIL PROTECTED]]On Behalf Of
> >steve silvers
> >
> >How can I put a white space between every second number.
> >I have $a = (12345678904539);
> >I want 12 34 56 78 90 45 39
>
>And this worked for me:
>     s%([\d]{2})%$1 %g;
>
>---
>Steve Martin
>[EMAIL PROTECTED]
>
>
>_______________________________________________________
>WIN a first class trip to Hawaii.  Live like the King of Rock and Roll
>on the big Island. Enter Now!
>http://r.lycos.com/r/sagel_mail/http://www.elvis.lycos.com/sweepstakes
>_______________________________________________
>Perl-Win32-Users mailing list
>[EMAIL PROTECTED]
>To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to