Re: Just chipping in...
Jasper <[email protected]> Thu, 15 Nov 2007 16:46:49 +0000
| Newsgroups | gmane.comp.lang.perl.golf |
|---|---|
| Message-ID | <[email protected]> |
I give up! I should learn to check before posting... This doesn't work either. It looks like it does without counting the results, though :S On 15/11/2007, Jasper <[email protected]> wrote: > 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 > -- Jasper