I'm looking at /usr/bin/pkg-config on OpenBSD. Is there a reason to write this ...
Code:
if (defined($ENV{PKG_CONFIG_LIBDIR}) && $ENV{PKG_CONFIG_LIBDIR}) {
@PKGPATH = split(/:/, $ENV{PKG_CONFIG_LIBDIR});
} elsif (defined($ENV{PKG_CONFIG_PATH}) && $ENV{PKG_CONFIG_PATH}) {
unshift(@PKGPATH, split(/:/, $ENV{PKG_CONFIG_PATH}));
}
... instead of this ...
Code:
if ($ENV{PKG_CONFIG_LIBDIR}) {
@PKGPATH = split(/:/, $ENV{PKG_CONFIG_LIBDIR});
} elsif ($ENV{PKG_CONFIG_PATH}) {
unshift(@PKGPATH, split(/:/, $ENV{PKG_CONFIG_PATH}));
}
?
As far as I can tell, in boolean context a hash entry that doesn't exist will yield false, as will an entry that's there but undef, as will one that's there but one of the other false values (0, "", "0"). Neither does it seem like referring to a non-existent element will either cause a warning or autovivify anything.