何とかも何も、変数の冗長性を残しても3行になったよ。
#!/usr/bin/perl -w
$addr=$ENV{REMOTE_ADDR};open L,"+<.log";flock L,2;($c,$ip)=split/:/,<L>;
if($addr ne$ip){$c++;seek L,0,0;print L "$c:$addr";truncate L,tell(L);print
"Content-Type:text/plain\n\n$c"}