Think about Loose Coupling | |
PerlMonks |
Re: conditional print. Is correct to use it?by choroba (Cardinal) |
on Oct 27, 2020 at 12:04 UTC ( [id://11123205]=note: print w/replies, xml ) | Need Help?? |
What's the question?
No, it doesn't exit. It continues running the program on the next line.
There are only few values considered false in Perl: an undefined value, empty string, 0, and the string "0". In this case, it's the empty string, so you see the alternative value.
An empty string in numeric context is treated as zero. 0 + 2 is two which is true, so no need to substitute 8.
See above. 0 + 0 = 0 and that's what we see.
Again, an empty string in numeric context is 0, 0 + 0 is 0 which is false, so we see 8. Modern Perl explains context in a nice and simple way: see Context.
map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
In Section
Seekers of Perl Wisdom
|
|