Phil Carmody wrote: > > Embarassment time - > perl -e > '"${s}1_${s}2"=~/(.*)\1_.*?(.*)\2$/,print$s.=1+(length$1>length$2),$/for(0..98)' > > The task was to produce the "Linus sequence" where either a 1 or a 2 is added > to the seed "1", such that the contiguous repeat at end of the string is > minimised at each stage. > > The code's therefore pretty self explanatory, but more explanation > can be found at google groups: > Message-ID: <[EMAIL PROTECTED]> > > I'm slaughtered by my double "length", but can't see a way round it, > and on the keyhole front, my initial "${s}"s aren't very elegant. > > Anyone got a few pointers for improving it?
double length? what double length? perl -le '[EMAIL PROTECTED]($-["[EMAIL PROTECTED]"=~/(.*)\1$/]<$-["[EMAIL PROTECTED]"=~//])for 0..98' (some golf tricks applied :) -- Rick Klement