Re: Briskets (perl)
Re: Briskets (perl)
- Subject: Re: Briskets (perl)
- From: Arthur J Knapp <email@hidden>
- Date: Tue, 14 May 2002 09:52:19 -0400
>
Date: Mon, 13 May 2002 18:40:33 -0500
>
Subject: Re: Briskets (perl)
>
From: Matthew Stuckwisch <email@hidden>
>
> $s="-oMmi\ncThhaee lW eKbe:l lhyt".
>
> "\ntEpm:a/i/lw:w wj.ejdeidmiimkie".
>
> "k\@em.ance.tc\n";for$i (0..length(
>
> $s)/2-1){$a.=substr($s,$i*2,1);$b.=
>
> substr($s,($i*2)+1,1);}print"$a$b";
>
Oh jeez, go and make such a simple script look so ugly. For those of you
>
who prefer "cleaner" perl:
>
$s="-oMmi\ncThhaee lW eKbe:l lhyt"."\ntEpm:a/i/lw:w wj.ejdeidmiimkie"."k\@
>
em.ance.tc\n";
Uh, oh, thank's for cleaning that up. ;-)
>
for$i(0..length($s)/2-1)
>
{
>
$a.=substr($s,$i*2,1);
>
$b.=substr($s,($i*2)+1,1);
>
}
>
>
print"$a$b";
>
and for those of you who want a rough AppleScript conversion:
>
set s to "-oMmi
>
cThhaee lW eKbe:l lhyt
>
tEpm:a/i/lw:w email@hidden
>
"
>
>
set a to ""
>
set b to ""
>
>
repeat with i from 0 to round (length of s) / 2 - 1
>
set a to a & text (2 * i + 1) thru (2 * i + 1) in s
>
set b to b & text (2 * i + 2) thru (2 * i + 2) in s
Less verbose:
set a to a & item (2 * i + 1) of s
set b to b & item (2 * i + 2) of s
>
end repeat
>
>
return a & b
Good stuff.
>
Trying to go and make perl all bad....humbug :P
Yeah, Perl doesn't need any help with looking bad... ;-)
{ Arthur J. Knapp, of <
http://www.STELLARViSIONs.com>
<
mailto:email@hidden>
try
<
http://www.apple.com/applescript/>
on error number -128
end try
}
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.