Re: Just chipping in...

Jasper <[email protected]> Thu, 15 Nov 2007 16:45:17 +0000
Newsgroups gmane.comp.lang.perl.golf
Message-ID <[email protected]>
On 15/11/2007, Jasper <[email protected]> wrote:

>
> \$h{$_='()'x$ARGV[0]};
> \$h{$_,reverse}while s/\)(.*?)\(/$1()/;
> print for sort keys %h;

Phil points out that reverse isn't actually a mirror (and scalar
reverse makes this horribly incorrect), so it turns out I have to do
this in two passes.

\$h{$_='()'x $ARGV[0]};
\$h{$_}while s/\)(.*?)\(/$1()/;
$_='()'x pop;
\$h{$_}while s/(.*)\)(.*?)\(/$1()$2/;
print for sort keys %h;

Hopefully someone can fix that :D

-- 
Jasper