#!/usr/local/bin/perl foreach(split /&/, $ENV{QUERY_STRING}){ ($n, $v) = split /=/; $v =~ tr/+/ /; $v =~ s/%([\da-f]{2})/chr(hex($1))/ieg; $in{$n} = $v; } if ($in{"HTTP_USER_AGENT"} =~ /DoCoMo/ ){ $str = '.gif'; }else{ $str = '.png'; } print "Content-type: text/html\n\n"; printf("",$in{"fname"},$str);