in reply to Regular expression
Nothing! The "1" does nothing. Well, it returns a value of 1, that is immediately thrown away. Only the condition in the while is interesting here, and its side effects. You could have written:
while (s/(\d)(\d\d\d)(?!\d)/$1,$2/) {}but it used to be slower in ancient version of Perl (I've read this in the Camel Book or the CookBook). Both Ways To Do It should be equivalent nowadays, but some habits die hard.
--bwana147
|
|---|