http://www.perlmonks.org?node_id=965732


in reply to Re^2: Print Number With Implied Decimal Point
in thread Print Number With Implied Decimal Point

Note that with a properly crafted regex, the timing difference between it and substr is pretty small; limiting the scope of bigint and using the look-ahead regex from Re^2: Print Number With Implied Decimal Point:
Rate regex substr regex2 regex 2926/s -- -78% -80% substr 13087/s 347% -- -11% regex2 14782/s 405% 13% --
Update: see Re^2: Print Number With Implied Decimal Point

#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.

Replies are listed 'Best First'.
Re^4: Print Number With Implied Decimal Point
by Eliya (Vicar) on Apr 18, 2012 at 15:46 UTC
    the timing difference between it and substr is pretty small

    Yes, sure.  My main point was the side effects of applying use bigint globally (which completely washes out any difference there might be), and not so much to support that substr is faster than regex.