[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: SV: [FWP] Can it be funner?



On Wed, 23 Jun 1999 patrik.grip-jansson@vv.se wrote:
> I believe the fun factor is slightly higher in this version;
> 
> $_="aaabbbbccaaajjjcccooaaabbbbjjjjjaeefcccooaaabbbbjjaajj";
> 
> for($n=0;/(.{$n,}).*\1/;$n=length($1)+1){$s=$1;};
> 
> print "$s\n";
> 
> It could probably do with some further obfuscation!

This specific code doesn't seem to work, though I can see what you
*meant*. Anyway, in this vein, here is a way to "sort" $_ --

    { redo if s{((.)(?>\2*))(.+?)(\2+)}{$1$4$3} }

Only in Perl...

Question: if you were allowed to use C<lt> or similar how would you
sort a string in ascending order with "as little eval as possible"?
And as few s/// as possible...

--
Tushar Samant
~
~
:wq


==== Want to unsubscribe from Fun With Perl?
==== Well, if you insist... Send mail with body "unsubscribe" to
==== fwp-request@technofile.org