Microblogi: A very long article Wikipedia article on the orientation of toilet paper [7. kes klo 22:52] [V]

Torstai, 28. elokuuta 2008

Word Scrambler, Write-Only Version

Käännös: [ Google ]

Kategoriat: [ ATK ]

Here's a more compact, less readable version of the scramble function:

sub scramble {
  return $_[0] if $_[0] =˜ /ˆ[A-Z]/;
  my @l = split //,$_[0];
  @l[1..$#l-1] =
     sort { rand(1) < 0.5 ? -1 : 1 } @l[1..$#l-1];
  return join("", @l);
}

[ Postattu 28. elokuuta 2008 klo 00.05 | ei kommenttia | ]