OK, last gasp of my silly tirade...
Bogart Salzberg:
Is there a compelling reason why lc() and friends must return a defined value at all times? Just curious...
Aaron Sherman:
Not sure if you got an answer to your question or not, but essentially, yes.
lc is defined as modifying a string by performing the appropriate upcase operation on all of its elements.
When an undefined value is treated as a string, it is converted into the empty string (this is universal in perl).
So, in essence this is the same as performing math on undef and getting back 0.
Bogart Salzberg:
OK, I concede that you and Uri are right. Since lc() expects a string, it should be expected to return a string. But I still think lc() should WARN me if its argument is undefined, and this would be consistent with the behavior of the concatenation operator that Uri demonstrated, if I understand correctly.
(To paraphrase):
1. Undefined value on left... common enough... no warning:
$ perl -we 'my $string; $string .= $_ for ("RED", "blue"); print $string, "\n";'
REDblue
2. Undefined value on right... warn me:
$ perl -we 'my $string; $string .= $_ for ("RED", undef, "blue"); print $string, "\n";'
Use of uninitialized value in concatenation (.) or string at -e line 1.
REDblue
(To elaborate):
3. Undefined argument to lc()... silent... maybe it shouldn't be...
$ perl -we 'my $string; $string .= lc($_) for ("RED", undef, "blue"); print $string, "\n";'
redblue
Sorry to belabor the point. I just think it's interesting.
Bogart
_______________________________________________ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm

