2 ms·
Perl has built-in temp files
- Oatseller 11y ago> When I asked on IRC recently, whether I was missing some reason that it wasn't more common, almost every single response was, "Woah, I never heard of that feature." They should read the excellent perldocs for 'open' [0][1], it's been available since ~2002 (Perl 5.8) [2][3] You can change the directory it uses by overriding the defailt $TMPDIR ($ENV{TMP} in Windows 7) $ENV{TMP} = '/path/to/my/tmp/dir'; open my $fh2, '+>', undef or die "$!"; It was introduced along with another useful feature, 'File handles can be opened to "in memory" files held in Perl scalars' [0][2] open(my $fh,'>', \my $variable) or die "$!"; ... do stuff to $variable as if it were a file [0] http://perldoc.perl.org/functions/open.html http://perldoc.perl.org/functions/open.html [1] http://perldoc.perl.org/perlopentut.html http://perldoc.perl.org/perlopentut.html [2] http://perldoc.perl.org/perl58delta.html#PerlIO-is-Now-The-Default http://perldoc.perl.org/perl58delta.html#PerlIO-is-Now-The-D... [3] https://books.google.com/books?id=IzdJIax6J5oC&lpg=PA1&dq=&pg=PT300#v=onepage&q&f=false https://books.google.com/books?id=IzdJIax6J5oC&lpg=PA1&dq=&p...