note
Tyke
This is another approach that might not be shorter, but
does work with ruler lengths that aren't a multiple of
10. <B>Update</B>: Just noticed that [petral] does it
more neatly.
<CODE>
#!perl -w
use strict;
print ruler(@ARGV);
sub ruler {
my ($x,$y) = (' ', '');
map{$x.=sprintf('%10d',$_/10) if $_%10 == 0 && $_ != 0; $y.=$_%10} (0..$_[0]);
return "$x\n$y\n";
}
</CODE>
I would have liked to use <CODE>for</CODE> rather than
<CODE>map</CODE>, but I couldn't get the 1 line version
to compile ;-(
<p>
I also can't get it to work with non-positive integer
values ;-((.
69240
69240