produces:use strict; my $temp; $temp = defined ($temp = func()) ? $temp : 'undefined'; print "func:$temp\n"; $temp = func() || 'undefined'; print "func:$temp\n"; sub func { return ''; }
func: func:undefined
In reply to Re: Re: Safe to use ternary operator like this?
by Albannach
in thread Safe to use ternary operator like this?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |