File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -11,17 +11,17 @@ L<IO::Path|/type/IO::Path> types.
11
11
12
12
= head1 Reading from files
13
13
14
- To read in the contents of a file one could open the file via the C < open >
14
+ One way to read the contents of a file is to open the file via the C < open >
15
15
function with the C < :r > (read) file mode option and slurp in the contents:
16
16
17
17
my $fh = open "testfile", :r;
18
18
my $contents = $fh.slurp-rest;
19
19
$fh.close;
20
20
21
- where we explicitly close the file handle using the C < close > method on the
22
- C < IO::Handle > object. This is a very traditional way of reading the
23
- contents of a file. However, we can do the same much more easily and
24
- clearly like so:
21
+ Here we explicitly close the file handle using the C < close > method on the
22
+ C < IO::Handle > object. This is a very traditional way of reading the
23
+ contents of a file. However, the same can be done more easily and clearly
24
+ like so:
25
25
26
26
my $contents = "testfile".IO.slurp;
27
27
# or in procedural form:
You can’t perform that action at this time.
0 commit comments