I
ihok
Consider:
# colors -> colours
$token = 'colors';
$token =~ s/or(ed|ing|s)?$/our$1/;
But if $token == 'color', Perl emits a warning: Use of uninitialized
value in concatenation (.) or string. True enough, $1 is undefined,
but why bother warning? I mean, my regexp has a '?' in it because I
expect that sometimes 'color' will not have an ending.
I suspect that the answer is "it's simpler to just warn whenever an
undefined variable occurs in a string, and it's just not worth it to
detect the case when such a warning is vacuous. Try 'no warnings'.' I
can deal with that.
# colors -> colours
$token = 'colors';
$token =~ s/or(ed|ing|s)?$/our$1/;
But if $token == 'color', Perl emits a warning: Use of uninitialized
value in concatenation (.) or string. True enough, $1 is undefined,
but why bother warning? I mean, my regexp has a '?' in it because I
expect that sometimes 'color' will not have an ending.
I suspect that the answer is "it's simpler to just warn whenever an
undefined variable occurs in a string, and it's just not worth it to
detect the case when such a warning is vacuous. Try 'no warnings'.' I
can deal with that.