A. Pagaltzis wrote
>* Marcus Holland-Moritz <[EMAIL PROTECTED]> [2007-12-09 21:20]:
>> We're all stuck at 21. :-)
>
> Well, `bless`, `shift` or `$_[0]`, `{}`, [EMAIL PROTECTED], and one comma are
> all inevitable. That's 15 characters in fixed strings alone. Then
> you'll also need to rearrange list or evaluation order somewhere,
> which means at least one pair of delimiters with two indices and
> a separator inside, so that's another 5 tokens that can't be any
> shorter than 1 character.
>
> Therefore no possible solution to this problem can be any shorter
> than 20 characters under any circumstances.
>
> Besides the solutions already posted, I found a couple of ways to
> write it in 22 characters, plus two more ways to do it in 21
> characters, one of should work but doesn't because of that stupid
> prototype that `bless` has.
>
> But I didn't manage to beat 21 characters, probably because it's
> not possible. Beating 20 would certainly be impossible.

To me the following seventeen seems acceptable, at least as long
as there's certainty that the "abused" additional key/value pair
doesn't clash with class functionality, and it even circumvents
the evaluation order thingy:

sub new{bless{0,@_},$_[0]}

-Chris

COC AG, Marktler Strasse 50, 84489 Burghausen,  Deutschland,  Amtsgericht 
Traunstein, HRB 17218,  USt-ID-Nr. DE 251 388 010
Vorstand: Ralf Schuster (Vorstandsvorsitzender), Andreas Bublak, Renate 
Linhart, Aufsichtsratsvorsitzender: Günter W. Engerer

COC AG, Marktler Strasse 50, 84489 Burghausen, Germany, Commercial Registry 
Traunstein, HRB 17218, VAT Reg.No. DE 251 388 010
Managing Board: Ralf Schuster (CEO), Andreas Bublak, Renate Linhart, Chairman 
of the Supervisory Board: Günter W. Engerer

Reply via email to