#!/usr/bin/perl use CGI; $q = new CGI; print $q->header, $q->start_html; $message=$q->param('message'); # done automatically by PHP if ($message) { @a = split(' ', $message); @b = (); while ($#a >= 0) { $i = int(rand($#a+1)); # randomly choose one element in @a splice(@b, 0, 0, $a[$i]); # put it on the left of @b splice(@a, $i, 1); # ... and take it out from @a } $message = join(' ', @b); } else { @a = ("one", "two", "three", "four", "five", "six"); $message = join(' ', @a); } print qq{
}; print $q->end_html;