That's because after your regex has processed the first two numbers, it
moves on to the next two numbers.  If you inputted 1234, you would probably
get back "1.23.4".

If I were you, I'd try something more like this:

my @numarray = split(//,$_);
$_ = join('.',$_);

-----Original Message-----
From: Dusan Juhas [mailto:[EMAIL PROTECTED]]
Sent: Friday, July 12, 2002 9:17 AM
To: [EMAIL PROTECTED]
Subject: an error in a simple regexp


Hi,
I typed this simple cmd in the bash:
echo 123 |perl -pe 's/(\d)(\d)/$1.$2/g'
and expected ouput like
1.2.3
but obtained this one:
1.23

What's wrong and how to write a regexp cmd which will
transfer a number to digits with dots in between?
eg: 1234 -> 1.2.3.4
Thanx

Regards,
Dusan


-- 
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