Showing posts with label Perl Core Useful FindBin. Show all posts
Showing posts with label Perl Core Useful FindBin. Show all posts

Tuesday, March 3, 2009

Temp file in Perl

Use the following to generate a temporary file in Perl:


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