If I understand your problem correctly, then there's no need for the "delete and copy" dance.
Simply
open your tempfile for output and it will automatically get created or
truncated.
You already populated your
@outagenodes from the data read from your serverlist. So why don't you simply:
open(my $tempfh, ">", $tempfile) or die "couldn't open $tempfile: $!";
print$tempfh @outagenodes or die "error when writing: $!";
close $tempfh or die "huh?? - $!";
BTW I deliberately leave off the space in
print$filehandle to remind myself that there's
no comma between the file handle and the list...