in reply to Re: question about || operator and list context
in thread question about || operator and list context
use File::Temp (qw/tempfile/); (($fh,$fname) = tempfile('quanta-XXXX')) || die "Couldn't create temp file $fname\n";
The results without the extra parens differed a bit from the example above, though. $fh got set to a GLOB (a filehandle, I assume). This is the /first/ element in the array return, not the last.
I understand why that is now, though-- the || forced the subroutine to scalar context, in which it just returns a filehandle.
This made it more mysterious to debug though, since it wasn't returning just the last element of the array, which I might have recognized sooner.
Thanks to all for your help.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: question about || operator and list context
by BrowserUk (Patriarch) on Jun 22, 2003 at 04:29 UTC |