Outputfile is not saving - Perl solved

Dear all
I have this perl script where it also linked R script but the outputfile (anchorresult.temp)is also disappearing after I got the R figure. Do you guys know how to preserve the file

#!/usr/bin/perl

$anchorfile=&QQQ("Anchor file (include the path):");
$anchortype=&QQQ("Anchor type (Point or Segment):");
$scale=&QQQ("Scale segment length to (mean, median, min, max or custom(eg:30) ):") if $anchortype eq "Segment";
$scale=1 if $anchortype eq "Point";
$signalfile=&QQQ("Signal file(include the path):");
$signaltype=&QQQ("Signal type (Point or Segment):");
$scopefile=&QQQ("Scope file (hg18, mm9, ce6, dm3 or custom file(include the path) ):") if $signaltype eq "Segment";
$plotRange=&QQQ("Plot range (+/- N bp, default is 2000):");
$plotRange=2000 if $plotRange eq "";
$scopefile="coords.".$scopefile if $scopefile eq "hg18" || $scopefile eq "mm9" || $scopefile eq "ce6" || $scopefile eq "dm3";

if($signaltype eq "Segment")
{
	system("./anchor.to.tag $anchorfile $signalfile $scale > anchorsignal.temp");
	system("./anchor.to.tag $anchorfile $scopefile $scale > anchorscope.temp");
	system("./anchor.map.tagscope anchorsignal.temp anchorscope.temp $scale -$plotRange $plotRange > anchormap.temp");
	system("./cutcolumn anchormap.temp 2 3 > anchorresult.temp");
}
elsif($signaltype eq "Point")
{
	system("./anchor.to.probe $anchorfile $signalfile $scale > anchorsignal.temp");
	system("./anchor.map.probe anchorsignal.temp $scale -$plotRange $plotRange > anchormap.temp");
	system("./cutcolumn anchormap.temp 1 2 > anchorresult.temp");
}
else
{
	print "Anchor type is wrong! Please choose 'Segment' or 'Point'.\n";
}

open out,">gsaRscript.temp";
print out <<END;
mydata = read.table("anchorresult.temp",sep="\\t")
attach(mydata)
pdf("gsa_result.pdf")
plot(mydata[,1],mydata[,2],ylab="Signal",xlab="Relative distance to anchor",cex=0.2,type="l",xlim=c(-$plotRange,$plotRange))
dev.off()
END
close out;

system("Rscript gsaRscript.temp");
system("rm *.temp");

sub QQQ
{
	my $question = shift @_;
	print "$question\n";
	chomp(my $answer = <STDIN>);
	return $answer;
}

---------- Post updated at 07:43 AM ---------- Previous update was at 07:34 AM ----------

sorry guys. I found the bug i forgot to put # before

system("rm *.temp");

No need of any answers. Thanx