Paul Murphy said:
>
>
> Hello, this is a two part question: a how to, and a how best to.
>
> I have a string of numbers:
>
> "2329238023089823"
>
> And I want insert a space after each number.  I can see how to insert
> after the first:
>
> s/(\d)/$1 /
>
> Can any one tell me how I can get the regexp to continue through the
> string and insert spaces throughout?

Stick a "g" on the end.

> The next part of the question is, given the above string, what is the
> best way of displaying the string with the added spaces, without
> necessarily altering it in the variable?

Best?  That depends.  One way is:

  print join " ", split //, $str;

That is slightly different in that there is no space at the end.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net




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

Reply via email to