http://qs321.pair.com?node_id=415505

IBM have a monthly riddle set up called Ponder This. The riddles are mathematical -- too difficult for me :)

Here's part of Novermber's (cute) riddle, followed by a Perl solution that surprised me for being so short and, to my perlverted mind, straightforward. I've only begun looking at that site, but I bet other riddles there can be solved with Perl, too.

The numbers 1 to 9999 (decimal base) were written on a paper. Then the paper was partially eaten by worms. It happened that just those parts of paper with digit "0" were eaten. Consequently the numbers 1200 and 3450 appear as 12 and 345 respectively, whilst the number 6078 appears as two separate numbers 6 and 78. What is the sum of the numbers appearing on the worm-eaten paper?
perl -le '$sum += $_ for map { split /0/ } 1 .. 9999; print $sum' 37359000