sub ruler { my($n,$r) = ($_[0], ' '); $r .= ' 'x(10-length).$_ for (1..($n+9)/10); return "$r\n" . '0123456789' x (($n+9)/10) . "0\n"; }