in reply to Re: YAPC::EU::2013 reg.ru Go Perl golf contest
in thread YAPC::EU::2013 reg.ru Go Perl golf contest
Variable-length negative look-behind can be emulated using \K. The two regexes are almost identical, and can be abstracted in a variable. "@-" is shorter than "$-[0]". If using perl >= 5.14, /./ followed by "$& $'" can be replaced with s/./$& /r.
All in all, that's 30 characters easily chipped off. There’s still a lot of room for improvement—this next is hurting my eyes. I’ll probably look at it some more another day.
#!perl -ln0 $:='(.{9}|)\Kw|w(?=(.{9}|)'; map{$i="@-"+11;{map{1while s/W$:W)/W/s;/ \U$: )/s||print($i=~s/./$& /r)+next}"$`W$'"while/w/g}}"$ +`x$'"while/ /g
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: YAPC::EU::2013 reg.ru Go Perl golf contest
by Grimy (Pilgrim) on Aug 22, 2013 at 11:44 UTC |