Re: bad code to good golf
[email protected] (Marcus Holland-Moritz) Sun, 9 Dec 2007 10:53:48 +0100
| Newsgroups | perl.fwp |
|---|---|
| Message-ID | <20071209105348.336c9eeb@r2d2> |
On 2007-12-09, at 00:28:08 -0800, Michael G Schwern wrote:
> Uri Guttman wrote:
> > i have two solutions of 33 and 24 chars so you have to beat those. the
> > longer one is amusing enough to show it later.
>
> sub new {bless{@_[1..$#_]},shift}
>
> Was my first shot at 23. Then I figured I could knock off that range op...
>
> sub new {$a=shift;bless{@_},$a}
>
> 21. And it's even strict clean. :)
Also at 21, also strict safe, and doesn't "misuse" $a ;-)
sub new {bless{splice@_,1},pop}
Marcus
--
Quality Control, n.:
The process of testing one out of every 1,000 units coming off
a production line to make sure that at least one out of 100 works.
signature.asc
(application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (GNU/Linux) iD8DBQFHW7ss+WHr1iaAu0YRArBBAKCpLa+UWV/qMynvSgPolYe/knOHsQCeMNHG 6klJs9/cUMpAeH/8ZLcHUSM= =1Ewn -----END PGP SIGNATURE-----