Re: A sort of perl golf challenge
Ooh, that's *sneaky*. However it barfs under "use warnings": Argument "2, " isn't numeric in addition (+) at (re_eval 1) line 1. Can't see any easy way of fixing it though...
View ArticleRe: A sort of perl golf challenge
Got it. This one’s in fact even shorter, heh. sub collapse { my $str = join ', ', @_; $str =~ s/(\d+)(?:, ((??{$^N + 1})))+/$1-$^N/g; return $str; } But I just noticed it’s buggy without the \b...
View ArticleRe: A sort of perl golf challenge
PS.: I don’t know if you ever noticed my (admittedly long-after-the-fact) response to your other golf challenge.
View ArticleRe: A sort of perl golf challenge
Nice, moving the ", " match before the repeating part means you can still do the repeated capture trick. And yes, I did see your previous comment - yours was the shortest so I guess you win;-) I don't...
View ArticleRe: A sort of perl golf challenge
Alan,thats awesome I don't quite understand how this thing works could it return the data as arrays ? somthing like this ?"[1],[3,4,5],[8,9,10],[12]" though for my purpose it would be better if "[]"...
View Article