package scramble;
-use List::Util;
-
sub scramble
{
my ($text) = @_;
my $scrambled;
+ return unless &::loadPerlModule("List::Util");
srand(); # fork seems to not change rand. force it here
for my $orig_word (split /\s+/, $text)
{
{
# non-random shuffle, but good enough
($new_middle = $middle) =~ s/(.)(.)/$2$1/g;
- last;
}
# shuffle the middle letters
- $new_middle = join "", List::Util::shuffle(split //, $middle);
+ $new_middle = join '', List::Util::shuffle(split //, $middle);
}
- while ($middle eq $new_middle);
+ while (($cnt < 10) && ($middle eq $new_middle));
# add the word to the list...
$scrambled .= "$first$new_middle$last ";
# been included in the original string
$scrambled =~ s/\s+$//;
- &::pSReply($scrambled||"Unknown Error Condition");
+ &::performStrictReply($scrambled||'Unknown Error Condition');
}
1;