L
Len
I expected this to give a warning for "uninitialized value" :
perl -w -e 'my $abc; print "\L$abc";'
But it doesn't!
Why is this different from:
perl -w -e 'my $abc; print "$abc";'
which DOES give the expected warning ?
Is it documented that lc() doesn't mind an undefined argument ?
Or is something else going on?
I'm interested in this because the following would be kind of neat
if I could trust that it would work cleanly into the future,
even if Flag was missing from the hash:
if ("\L$hash->{'Flag'}" eq 'yes') {...}
If I don't understand why it works, I'll continue to use the rather
messier:
if (lc ($hash->{'Flag'} || '') eq 'yes') {...}
(BTW, about omitting the quotes, as in $hash->{Flag} :
is this considered sound practice, or is it just lazy ?)
Cheers,
-Len
perl -w -e 'my $abc; print "\L$abc";'
But it doesn't!
Why is this different from:
perl -w -e 'my $abc; print "$abc";'
which DOES give the expected warning ?
Is it documented that lc() doesn't mind an undefined argument ?
Or is something else going on?
I'm interested in this because the following would be kind of neat
if I could trust that it would work cleanly into the future,
even if Flag was missing from the hash:
if ("\L$hash->{'Flag'}" eq 'yes') {...}
If I don't understand why it works, I'll continue to use the rather
messier:
if (lc ($hash->{'Flag'} || '') eq 'yes') {...}
(BTW, about omitting the quotes, as in $hash->{Flag} :
is this considered sound practice, or is it just lazy ?)
Cheers,
-Len