4 ms·
I prefer the source which I think is a clearer explanation. The key is that perl’s x operator turns the number into a string of 1s that is the length of the num
by mmaunder 5y ago
I prefer the source which I think is a clearer explanation. The key is that perl’s x operator turns the number into a string of 1s that is the length of the number. The rest is a hack to use regex to perform division using minimal capturing and back references.
http://montreal.pm.org/tech/neil_kandalgaonkar.shtml http://montreal.pm.org/tech/neil_kandalgaonkar.shtml
- btdmaster 5y agoIt's crazy how fast Perl's regex engine does this!