my $http_accept_encoding = $ENV{'HTTP_ACCEPT_ENCODING'}; my $is_gzip = 0; my $is_compress = 0; if($http_accept_encoding) {   if($http_accept_encoding eq "*") { $is_gzip = $is_compress = 1; }   else   {      foreach my $part (split(', ?', $http_accept_encoding))      {         my $enctype = "";         my $q = 0;         if(index($part, ";") > -1)         {            $part =~ m!^(\w+);\s*q\s*=\s*(.+?)\s*$!i;            $enctype = lc($1);            $q = $2;           }         else         {            $enctype = lc($part);            $q = 1;         }         if($q > 0)         {            if($enctype eq "compress") { $is_compress = $q; }            if($enctype eq "gzip") { $is_gzip = $q; }         }      }   }   }