-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Guys,<br/>
<br/>
I have this basic perl script:<br/>
<div style="margin-left: 40px;">#!perl -w<br/>
use strict;<br/>
<br/>
use Env qw(EnvVar1 EnvVar2);<br/>
<br/>
my $EnvVar1="DefaultValue1" if ("" eq
"$EnvVar1");<br/>
my $EnvVar2="DefaultValue2" if ("" eq
"$EnvVar2");<br/>
my $Var3 = "$EnvVar1 -- $EnvVar2";<br/>
</div>
<br/>
When I run it, the perl interperter complains about "Use of
uninitialized value in concatenation" on the "Var3" line
(the last line.<br/>
<br/>
Did I mess things up by putting the "my" on the
"EnvVar1" and "EnvVar2" lines -- these variables
should be defined on the "use Env" line, right?<br/>
<br/>
If you were to re-write this whole section, how would you do it?
This is my thought:<br/>
<br/>
<div style="margin-left: 40px;">#!perl -w<br/>
use strict;<br/>
<br/>
use Env qw(EnvVar1 EnvVar2);<br/>
<br/>
my $EnvVar1 = "DefaultValue1" if (! exists ($EnvVar1));<br/>
my $EnvVar2 = "DefaultValue2" if (! exists ($EnvVar2));<br/>
my $Var3 = "$EnvVar1 -- $EnvVar2";<br/>
</div>
<br/>
Dan<br/>
<br/>
- - - - -<br/>
"Wait for that wisest of all counselors, time." -- Pericles<br/>
"I do not fear computer, I fear the lack of them." -- Isaac
Asimov<br/>
GPG fingerprint:6FFD DB94 7B96 0FD8 EADF 2EE0 B2B0 CC47 4FDE 9B68
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
iD8DBQFDFx/CsrDMR0/em2gRAjnJAKDjWccSSR95T9C/ZPGSNwMCCQiUzwCfc9Lg
TOQ6HWycMlibL+x3LZTBHHs=
=okW6
-----END PGP SIGNATURE-----