Permalink
Browse files

keep lines() with limit from reading an extra line

  • Loading branch information...
1 parent 9557da2 commit 9cf3a88b607a838ee2cedbb621c8f343d5f832b0 @labster labster committed Jun 2, 2013
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/core/IO.pm
View
@@ -140,7 +140,7 @@ my class IO::Handle does IO::FileTestable {
method lines($limit = $Inf) {
my $count = 0;
- gather while (my $line = self.get).defined && ++$count <= $limit {
+ gather while ++$count <= $limit && (my $line = self.get).defined {
take $line;
}
}

0 comments on commit 9cf3a88

Please sign in to comment.