develooper Front page | perl.golf | Postings from November 2007

Re: Just chipping in...

Thread Previous | Thread Next
From:
Jasper
Date:
November 15, 2007 07:09
Subject:
Re: Just chipping in...
Message ID:
81cd84130711150709lff636ccgb6379f08603f248f@mail.gmail.com
On 15/11/2007, Jasper <jaspermccrea@gmail.com> wrote:
> On 15/11/2007, Jasper <jaspermccrea@gmail.com> wrote:
> > On 15/11/2007, Phil Carmody <thefatphil@yahoo.co.uk> 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

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About