----- Original Message -----
From: "Zed Lopez" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 24, 2002 12:12 AM
Subject: Re: a very short, easy problem


> On Wed, Jan 23, 2002 at 01:53:55PM -0500, Yanick wrote:
> >  Shorterer:
> >
> >         @ary = $foo =~ /..?.?/g;
>
> Longer:
>

[...]

Slower and uglier:

$_ = 'string';
@_ = split '';
my @ary;
push @ary, join '', splice @_, 0, 3 while @_ > 0;

This is even uglier, but not *quite* working (for strings $_ % 3 != 0):

push @_, join '', splice @_, 0, 3
   while ( @_ != 0 or @_ = split '' )
   and @_ > int(length) / 3 + 1;

Can anyone make this work (using the split/splice/join method and using only
one statement and no vars except @_ and $_)?

Steffen
--
$_=qq#tsee      gmx.net#;s#e#s#g;s#[^\s\w]#c#;s#s#ust#g;s#t#J#e;s#nus#ker#
;chop;$c=' ^^^^ ';$c='12319';@c=split/(..)/,'8234130006710523';@d=split"3"
,$c;chop;'  at  ';s#(t)ustust#$1\0ano$1;.#;y#.; #ehr#;@_=$_;shift@c,substr
$_[0],$_,1,chr(ord(substr$_[0],$_)-shift@c)for$d[0]..$d[1];print"$_[0]\n";


Reply via email to