Closed p5pRT closed 20 years ago
Please modify the documentation for the substr() function in the perlfunc man page. It currently includes the following paragraph: If you specify a substring that is partly outside the string\, the part within the string is returned. If the substring is totally outside the string a warning is produced.
The phrases "partially outside" and "totally outside" are not well defined and are confusing. This topic has been extensively discussed in the newsgroup compl.lang.perl.moderated\, starting 1999-06-18\, with subject: substr does not warn when past the end of the string -- off by one bug?
Please rewrite this section.
Tom Phoenix has suggested the following wording:
Whether substr() is an lvalue or not\, the offset should be less than
I\
A warning is I\
my $name = 'fred'; substr($name\, 4) = 'dy'; # $name is now 'freddy' my $null = substr $name\, 6; # gives empty string my $oops = substr $name\, 7; # warning substr($name\, 7) = 'gap'; # fatal error
Please modify the documentation for the substr() function in the perlfunc man page. It currently includes the following paragraph: If you specify a substring that is partly outside the string\, the part within the string is returned. If the substring is totally outside the string a warning is produced.
The phrases "partially outside" and "totally outside" are not well defined and are confusing. This topic has been extensively discussed in the newsgroup compl.lang.perl.moderated\, starting 1999-06-18\, with subject: substr does not warn when past the end of the string -- off by one bug?
Please rewrite this section.
Tom Phoenix has suggested the following wording:
Whether substr() is an lvalue or not\, the offset should be less than
I\
A warning is I\
my $name = 'fred'; substr($name\, 4) = 'dy'; # $name is now 'freddy' my $null = substr $name\, 6; # gives empty string my $oops = substr $name\, 7; # warning substr($name\, 7) = 'gap'; # fatal error
Migrated from rt.perl.org#900 (status was 'resolved')
Searchable as RT900$