[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 Fri, September 2, 2005 07:01, Jay Hannah wrote:
> Actually, I wouldn't 'use Env' at all. That's just a "shortcut" for
> Perl's built-in %ENV. I'd do this:
>
> #!/usr/bin/perl -w
>
> $ENV{Var1} ||= "DefaultValue1";
> $ENV{Var2} ||= "DefaultValue2";
> my $Var3 = "$ENV{Var1} -- $ENV{Var2}";

Since the "||" operator is more well known with my team, I ended up using this:
my $Var1 = $Env{Var1} || "DefaultValue1";

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) iD8DBQFDGH7hsrDMR0/em2gRAr6UAKCmiSml7lQc2jIf3lFTNkF+U9H3nQCgrvsU j+IxGQzJp4qgp//cYiPXRaA= =Hegb -----END PGP SIGNATURE-----