[SPOILER] Solution for QOTW 23
Mark Jason Dominus <[email protected]>
| Newsgroups | gmane.comp.lang.perl.qotw.discuss |
|---|---|
| Organization | Plover Systems |
| Message-ID | <[email protected]> |
I'm really pleased with this. And I'm glad about the 60-hour
moratorium, because my first couple of solutions weren't nearly as
excellent.
#!/usr/bin/perl -l
print $_ = "()" x shift;
print while s{^ ( \(+ ) ( \)+ ) \( }
{"()" x (length($2) - 1)
. "(" x (length($1) - length($2) + 2)
. ")"
}xe;
__END__
That's all.
:) :) :D