Skip to content

Conversation

@5c30
Copy link

@5c30 5c30 commented Aug 13, 2025

Add additional wording for a negative count.

--

came up in libera #perl, there was confusion that "the last X lines" wasn't mentioned.

@ap
Copy link
Contributor

ap commented Aug 17, 2025

I suggest this more concise alternative, which I think reads more clearly:

diff --git a/lib/Path/Tiny.pm b/lib/Path/Tiny.pm
index 58862e4..66faff3 100644
--- a/lib/Path/Tiny.pm
+++ b/lib/Path/Tiny.pm
@@ -1364,8 +1364,8 @@ If C<binmode> is provided, it will be set on the handle prior to reading.
 
 If a positive C<count> is provided, that many lines will be returned from the
 start of the file.  If a negative C<count> is provided, the entire file will be
-read, but only C<abs(count)> will be kept and returned.  If C<abs(count)>
-exceeds the number of lines in the file, all lines will be returned.
+read, but only the last C<abs(count)> lines will be kept and returned.
+If C<abs(count)> exceeds the number of lines in the file, all lines will be returned.

 If C<chomp> is set, any end-of-line character sequences (C<CR>, C<CRLF>, or
 C<LF>) will be removed from the lines returned.

Mention that a negative count returns the last lines read.
@5c30
Copy link
Author

5c30 commented Aug 18, 2025

Thanks, that reads much better to me, too. I'll update the PR. If merged, please consider it attributed to @ap

@5c30 5c30 force-pushed the minor-doc-update branch from 46aba3d to 598a60d Compare August 18, 2025 01:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants