Skip to content

Commit 0abaf25

Browse files
authored
Mention "chomp in-place"
Also touched up definition to ensure it is clear that the target itself isn't returned.
1 parent 08cfdd8 commit 0abaf25

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

doc/Language/5to6-perlfunc.pod6

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,10 +209,12 @@ it as a method, e. g. C<$fh.chmod(0o755)>.
209209
=item chomp VARIABLE
210210
211211
The behavior of C<chomp> is different than in Perl 5. It leaves the
212-
target unaffected and I<returns> the target with a final logical newline
213-
removed. I. e. C<$x = "howdy\n";$y = chomp($x);> results in C<$x>
212+
target unaffected and I<returns> a copy of the target with a final logical newline
213+
removed, e.g. C<$x = "howdy\n";$y = chomp($x);> results in C<$x>
214214
containing "howdy\n" and C<$y> containing "howdy". Also works as a
215-
method, i. e. C<$y = $x.chomp>.
215+
method, e.g. C<$y = $x.chomp>. As with many other methods, also works
216+
with assignment to modify the target in place, e.g. C<$x.=chomp> results
217+
in C<$x> containing "howdy".
216218
217219
=head2 chop
218220

0 commit comments

Comments
 (0)