http://www.perlmonks.org?node_id=83072


in reply to Re: PGA Golf, Round 1
in thread PGA Golf, Round 1

I had similar solutions. But I improved on hole 3 to 20:
sub hole{map/^(.*?)\1+\z/s,@_}
and my solution for hole 5 was also 29 but somewhat different.
sub hole{$,=pop;$,=$,<$_?$_:$,for@_;$,}
However we can improve hole 5 to 28 taking your solution and applying my trick to it.:
sub hole{$,=pop;$_<$,or$,=$_ for@_;$,}

UPDATE
Oops. My test code put hole 3 in the wrong context. My bad.