Get rid of
system("rm -rf $file.tmp") # remove temp file
Get rid of system("rm -rf $file.tmp") # remove temp file
Why? Is it because that's better said as unlink "$file.tmp" or warn "Couldn't remove $file.tmp: $!"? Or is it because you don't want to remove the temp file? As with all of this stuff, you're welcome to implement the author's idea in any way that you wish on your own system
Yes better written as unlink (portability, safety).
and always some foolish person reuse -recursive and accidentally deletes all his files.