Skip to content

Commit f9032c0

Browse files
committed
Add line-by-line example to Language::io
1 parent 0f40e8d commit f9032c0

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

lib/Language/io.pod

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,17 @@ refer to the string as the file object itself and thus slurp in its
3333
contents directly. Note that the C<slurp> takes care of opening and closing
3434
the file for you.
3535
36+
=head2 Line by line
37+
38+
Of course, we also have the option to read a file line-by-line.
39+
40+
for 'huge-csv'.IO.lines -> $line {
41+
# Do something with $line
42+
}
43+
# or if you'll be processing later
44+
my @lines = 'huge-csv'.IO.lines;
45+
46+
3647
=head1 Writing to files
3748
3849
To write data to a file, again we have the choice of the traditional method

0 commit comments

Comments
 (0)