advantage of open is that its syntax is simpler
I'm not convinced of that. Apart from the "use" line, the File::Temp approach is about the same length and the intent is more immediately obvious.
open(my $fh, "+>", undef) or die ...
use File::Temp (); my $fh = File::Temp->new or die ...
-xdg
Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.
In reply to Re^2: Safe Temp Files
by xdg
in thread Safe Temp Files
by gmock
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |