[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 10:47, Kenneth Thompson wrote:

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

Is this what you’re trying to say?

my $EnvVar1 = ($EnvVar1 || "DefaultValue1");

my $EnvVar2 = ($EnvVar2 || "DefaultValue2");

my $Var3 = "$EnvVar1 -- $EnvVar2";

English:

If for some reason $EnvVar1 doesn’t have a value, use the value “DefaultValue1”

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-----