Is the following the best way to check if a scalar variable is initialized in Perl, using defined?
my $var;
if (cond) {
$var = "string1";
}
# Is this the correct way?
if (defined $var) {
...
}
Is the following the best way to check if a scalar variable is initialized in Perl, using defined?
my $var;
if (cond) {
$var = "string1";
}
# Is this the correct way?
if (defined $var) {
...
}