No explanation (yet), just an observation: strace shows Perl is creating temp files in all but the last case where the file name slot is $yund:
... open("/tmp/PerlIO_Ol6dlF", O_RDWR|O_CREAT|O_EXCL, 0600) = 3 unlink("/tmp/PerlIO_Ol6dlF") = 0 open("/tmp/PerlIO_WFvCgM", O_RDWR|O_CREAT|O_EXCL, 0600) = 3 unlink("/tmp/PerlIO_WFvCgM") = 0 open("/tmp/PerlIO_su06bT", O_RDWR|O_CREAT|O_EXCL, 0600) = 3 unlink("/tmp/PerlIO_su06bT") = 0 open("/tmp/PerlIO_HAAg8Z", O_RDWR|O_CREAT|O_EXCL, 0600) = 3 unlink("/tmp/PerlIO_HAAg8Z") = 0 Use of uninitialized value in open at ./799021.pl line 32. open("", O_WRONLY|O_CREAT|O_TRUNC, 0666) = -1 ENOENT (No such file or +directory) ...
Probably some special handling when the file name is an explicit scalar variable as opposed to just an undefined value...
(This is generally documented:
As a special case the 3-arg form with a read/write mode and the third argument being "undef": open(TMP, "+>", undef) or die ... opens a filehandle to an anonymous temporary file.
but it doesn't say anything about what happens if the undef isn't written literally...)
In reply to Re: open undef shift
by almut
in thread open undef shift
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |