use File::Temp;
my $fh = tempfile;
print $fh "temp data";
Also, this finds the directory of the Perl script being executed:
use FindBin;
my $program_dir = $FindBin::Bin;
This, and some other useful Perl things, are found here:
http://www.perl.com/pub/a/2003/05/29/treasures.html