This was a fun programming challenge.

This was a fun programming challenge. I solved it with side effects from a Perl regexp. That sounds scary, but the code ended up quite readable except for one line that’s obscure. It took me about 1.5 hours, but that was mostly debugging my missing “/s” on the regex. Sigh…

My solution (don’t peek if you want to solve it yourself!) is here: https://github.com/chrisdolan/luhnybin

Originally shared by Eric Burke

http://corner.squareup.com/2011/11/luhny-bin.html

http://corner.squareup.com/2011/11/luhny-bin.html