What's the shortest Perl one-liner that print out the first 9 powers of a hard-coded 2 digit decimal (say, for example, .37), each on its own line?
The output would look something like:
1
0.37
0.1369
[etc.]
Official Perl golf rules:
- Smallest number of (key)strokes wins
- Your stroke count includes the command line
31 characters - I don't have 5.10 to try out the obvious improvement using "say" but this is 28:
With perl 5.10.0 and above:
With older perls you don't have
say
and -E, but this works:Update: the first solution is made of 30 key strokes. Removing the first 0 gives 29. Another space can be saved, so my final solution is this with 28 strokes:
If you add -l to options you can skip the ,"\n" part
Just for fun in Perl 6:
28 characters:
27 characters:
(At least based on current whitespace rules.)
Just a quick entry. :)
Fixed to line break!