in reply to Re: Counting positive numbers
in thread Counting positive numbers
Using ~~ inchworm secret operator saves a stroke:
Update: The inchworm secret operator is more clearly described here. I remember it from good old TPR0 way back in 2002. You can read all about TPR0 and the other early Perl golf tournaments by downloading Terje/mtv's excellent Book of Perl Golf.#1234567890123456789012 perl -wle "print~~map{1..<>}2..<>"
Relaxing the first line restriction allows 20 strokes (which can probably be further shortened):
This time we use the }{ eskimo greeting secret operator in harness with Eugene's infamous $\ trick.#12345678901234567890 perl -pe "$.>1&$_>0and$\+=$_}{"
|
---|