On Tue, 15 Jan 2002 00:02:55 -0500, Michael G Schwern wrote:
>> If we like it -w clean: "length $3" will generate a warning if the
>> optional part isn't present, because then, $3 will be undefined. Thus:
>> testing defined($3) looks to be a better test, to me.
>
>length $3 doesn't throw a warning for some reason. $3 is probably ''
>when the optional part doesn't match.
No it's not. Try using $3 itself as as string, instead of something
depending on length($3), and you *will* get a warning. Besides, if $3
was defined, my version wouldn't work.
It's odd. length($s) commonly produces a warning if $s isn't defined.
But not here.
--
Bart.