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

Daniel Linder dan at linder.org
Fri Sep 2 09:37:12 PDT 2005



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



On Thu, September 1, 2005 17:37, Kenneth Thompson wrote:

<style type="text/css"> <!--  /* Style
Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{margin:0in;
	margin-bottom:.0001pt; 	font-size:12.0pt; 	font-family:"Times New
Roman";} a:link, span.MsoHyperlink 	{color:blue;
	text-decoration:underline;} a:visited, span.MsoHyperlinkFollowed
	{color:purple; 	text-decoration:underline;} span.EmailStyle17
	{mso-style-type:personal; 	font-family:Arial; 	color:navy;}
span.EmailStyle18 	{mso-style-type:personal-reply; 	font-family:Arial;
	color:navy;} @page Section1 	{size:8.5in 11.0in; 	margin:1.0in 1.25in
1.0in 1.25in;} div.Section1 	{page:Section1;} --> </style>


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


>Could be-
what does &ldquo;// &ldquo; 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-----
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/omaha-pm/attachments/20050902/7d00813b/attachment-0001.html


More information about the Omaha-pm mailing list