in reply to thanks, i'm new. rtfm right? :)

Here's a quick regex:

$tempfile =~ s!\.[^\.]+$!!;

That matches everything after and including the last literal period in the filename, and gets rid of it.