[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Omaha.pm] Proper way to test a variable with strict and -w?



-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Thu, September 1, 2005 17:37, Kenneth Thompson wrote:

>>Ah, this could be a good use of the "//" instead of "||", right?

>Could be- what does “// “ do?


I believe someone mentioned that it is a "smarter" form of "||" that is due to be included in a future release of Perl.  In this example, if the value to the left of "//" is a value, zero or empty string, then the value the "//" operator returns will be the value/zero/empty string respectively.  If the variable is not defined (or possibly "NaN" or other error values), then it will return the value on the right side of the "//" operator.

I haven't seen a writeup of this new functions planned implementation rules so this might be way off.

Dan

- - - - -
"Wait for that wisest of all counselors, time." -- Pericles
"I do not fear computer, I fear the lack of them." -- Isaac Asimov
GPG fingerprint:6FFD DB94 7B96 0FD8 EADF 2EE0 B2B0 CC47 4FDE 9B68 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQFDGH+3srDMR0/em2gRAqT2AKDH0N1uuOfnMX6r7xoT9FDiEygFpgCfVMh9 +njPrCHewOxANFXUMfGMTzE= =s59N -----END PGP SIGNATURE-----