in reply to Re: Symetrical Numbers (GOLF)
in thread Symmetrical Numbers (GOLF)
Well actually.....it doesn't break the counting code. Only the first instance of sub foo { is removed courtesy of the ^ The \n are gone by the time the sub bit is removed and even if they were not there is no /m. Although the sub removed is sub r the result is correct. To satisfy the spec sub r shoud be contained within sub n as the spec was for a single sub to do the task not a whole app! The code says 82 BTW :-)
use strict; my $code = <<'CODE'; sub r{$_[0]eq reverse$_[0]} sub n{foreach(1..$_[0]){$a{$_}=$_*$_ if r($_)&&r($_*$_)};\%a} } CODE $code =~ s/^\s+|\s+$//gm; $code =~ s/\n//g; $code =~ s/}$//; $code =~ s/^sub\s+(\w+)\s*{//; printf "Length of sub '$1' => %d chars", length $code; print "\n\n$code\n"; __END__
cheers
tachyon
s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print
|
|---|