Re: Just chipping in...
[email protected] (Jasper) Thu, 15 Nov 2007 15:09:22 +0000
| Newsgroups | perl.golf |
|---|---|
| Message-ID | <[email protected]> |
On 15/11/2007, Jasper <[email protected]> wrote: > On 15/11/2007, Jasper <[email protected]> wrote: > > On 15/11/2007, Phil Carmody <[email protected]> wrote: > > > I saw this on sci.math, and thought "one liner" ;-) > > > I even think a DP non-recursive approach should be quite quick. > > > Keeping the output in the logical order might cost a few strokes. > > > > and (mostly) with a regex :):wq > > \$h{$_='()'x$ARGV[0]}; > while(/\)\(/){ > s/\)(.*?)\(/$1()/; > \$h{$_,reverse}; > } > print for sort keys %h; Should read: \$h{$_='()'x$ARGV[0]}; \$h{$_,reverse}while s/\)(.*?)\(/$1()/; print for sort keys %h; of course! -- Jasper