|
|
|
|
|
by pjungwir
3985 days ago
|
|
The reason lines of code is a poor way to score solutions is that you should be counting characters! :-) My favorite Perl golf challenge is something I got from Boston Perl Mongers many years ago: You have the numbers 1 to 9 (in order), and in between each number you can insert a plus, a multiply, or nothing. Your program should print all expressions that evaluate to 2002. For instance it should print the solution 1*23+45*6*7+89
(and one other)I have a command-line solution in 80 characters, including the `perl ` at the beginning. It works on 5.10 and 5.16. I think there was a better solution back in the 5.8 days, but my notes are unclear. |
|