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

Daniel Linder dan at linder.org
Thu Sep 1 10:42:36 PDT 2005



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



On Thu, September 1, 2005 10:47, Kenneth Thompson wrote:

<style type="text/css"> <!--  /* Font
Definitions */  @font-face 	{font-family:Tahoma; 	panose-1:2 11 6 4 3 5 4
4 2 4;}  /* 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-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>


It could be
$EnvVar1 and 2 are in fact not initialized and that is the
complaint.


Is this what
you&rsquo;re trying to say?


my $EnvVar1 =
($EnvVar1 || "DefaultValue1");
my $EnvVar2 =
($EnvVar2 || "DefaultValue2");
my $Var3 =
"$EnvVar1 -- $EnvVar2";


English:
If for some
reason $EnvVar1 doesn&rsquo;t have a value, use the value
&ldquo;DefaultValue1&rdquo;










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



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)

iD8DBQFDFz2MsrDMR0/em2gRAvKEAKDgm22Bg0JTT3wmhFzooGIgCH762ACfXSsq
q/aV9w0/7N0pZ826lfAs20U=
=XDZ9
-----END PGP SIGNATURE-----
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/omaha-pm/attachments/20050901/eccfadc2/attachment.html


More information about the Omaha-pm mailing list