open(TMP,">$tmp") or die "error opening file $tmp: $!";