S
((20-length $x)/2), $x }'Nicholas Dronen said:s> Hi all,
s> here is a challenge for all of ya...
s> http://m_12321.tripod.com/c.htm
$ perl -wle 'for (reverse 0..9) { $x=$x?"$_$x$_":$_; print " " x
Ragnar said:((20-length $x)/2), $x }'
trivial improvement (untested):
$ perl -wle 'for (reverse 0..9) { $x=$x?"$_$x$_":$_; print " " x $_, $x }'
Ala said:perl -le map{print$"x$_,$x=$x?"$_$x$_":$_}reverse 0..9
Ala Qumsieh said:Hmmm .. reverse() is such a long-named function.
perl -le map{print$"x-$_,$x=$x?-$_.$x.-$_:-$_}-9..0
Ragnar Hafstað said:actually, this does not work as typed.
it does with quotes:
perl -le'map{print$"x-$_,$x=$x?-$_.$x.-$_:-$_}-9..0'
but then this is better:
perl -le 'print$"x-$_,$x=$x?-$_.$x.-$_:-$_ for-9..0'
Ragnar Hafstað said:and even better:
perl -le'print$"x-$_,$x=$x?-$_.$x.-$_:9 for-9..0'
Hmmm .. reverse() is such a long-named function.
perl -le map{print$"x-$_,$x=$x?-$_.$x.-$_:-$_}-9..0
-l print$"x-$_,$x=-$_.$x.($x&&-$_)for-9..0
and would score 44 and 42 strokes respectively. Notwithstanding my
(limited!) experience with Perlgolf gurus popping out with solutions
you wouldn't have ever imagined about, I doubt that one can do
anything better than the last one...
one more character:
perl -le'print$"x-$_,$x=$x?-$_.$x.-$_:9for-9..0'
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.