見るたびに背景色を変える
#! /usr/local/bin/perl # 配列の作成 @color = ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'); # 0から15の乱数を発生させる $c1 = int(rand 16); $c2 = int(rand 16); $c3 = int(rand 16); $c4 = int(rand 16); $c5 = int(rand 16); $c6 = int(rand 16); # 乱数を配列の文字に変換 $c1 = $color[$c1]; $c2 = $color[$c2]; $c3 = $color[$c3]; $c4 = $color[$c4]; $c5 = $color[$c5]; $c6 = $color[$c6]; # HTML出力 print "Content-type: text/html\n\n"; print "<html>\n"; print "<head>\n"; print "<title>見る度に背景色が変わります</title>\n"; print "</head>\n"; print "<body bgcolor=\"#$c1$c2$c3$c4$c5$c6\">\n"; print "見る度に背景色が変わります<br>\n"; print "</body>\n"; print "</html>\n"; exit;
〔 実行する 〕