print "Content-type: text/html\n";
print "\n";
print "<HTML>\n";
print "<HEAD>\n";
print "<TITLE>Browser Information in Perl</TITLE>";
print "</HEAD>\n";
print "<BODY>\n";
print "<p align=center><font size=5><strong>";
print "Browser Information ";
print "<img src=../../images/clam1.jpg";
print " width=85 height=75 align=middle>";
print " in Perl</strong></font></p>";
print "<p align=center><font size=4>The Perl";
print " Merchant perceives the following information";
print " about your browser.</font></p>";
print "<table BORDER=1 cellspacing=0 ";
print " cellpadding=3 align=center>\n";
print "<tr><td>HTTP User Agent</td><td>";
print "$ENV{HTTP_USER_AGENT}</td></tr>\n";
$browser = $ENV{HTTP_USER_AGENT};
$browser =~ s/Windows /Win/gi;
$browser =~ tr#[]/(;) #       #s;
@brw = split(/ /,$browser);
if ($#brw > 1) {
  $Bname = $brw[0];
  $Bvers = $brw[1];
  $Boper = "";
  for ($pos = 2; $pos <= $#brw; $pos++){
    $inf = $brw[$pos];
    if ($inf eq "MSIE"){
	  $Bname = $inf;
	  if ($pos+1 < $#brw){
	    $Bvers = $brw[$pos+1];
	  }
	}
    if ((substr($inf,0,3) eq "Win")
	 || (substr($inf,0,3) eq "Mac")
	 || (substr($inf,0,3) eq "Web")
	 || (substr($inf,0,3) eq "Sun")
	 || (substr($inf,0,2) eq "HP")
	 || (substr($inf,0,3) eq "AIX")
	 || (substr($inf,0,3) eq "BSD")
	 || (substr($inf,0,7) eq "FreeBSD")
	 || (substr($inf,0,3) eq "OSF")
	 || (substr($inf,0,4) eq "IRIX")
	 || (substr($inf,0,5) eq "Linux")
	 || (substr($inf,0,4) eq "OS/2")){
	  $Boper = $inf;
	}
  }
}
$Bmaj = int($Bvers);
print "<tr><td>Browser</td><td>$Bname</td><tr>\n";
print "<tr><td>Version</td><td>$Bvers</td><tr>\n";
print "<tr><td>Major</td><td>$Bmaj</td><tr>\n";
print "<tr><td>Platform</td><td>$Boper</td><tr>\n";
print "</table>\n";
print "</BODY>\n";
print "</HTML>\n";

