#!/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); $first = splice(@a, 0, 1); $message = join(' ', @a); $anotherMessage = "You are looking at: " . $first; } else { @a = ("one", "two", "three", "four", "five", "six"); @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 } $anotherMessage = "The game has just (re)started. The deck is shuffled."; $message = join(' ', @b); } print qq{
}; print $q->end_html;