As in other high level languages one has to open a file in order to read
from it or to write to it. In Perl6 it is done by the open
function that receives two parameters. The name of the file and the mode.
In order to open a file for reading the mode need to be :r.
the function either returns a file handle that should be placed in a scalar variable
or returns undef.
$fh = open $filename, :r
Once we have an open file handler we can use the =$fh syntax to read one line
(the next line) from the given file.
| Prev | Home (Copyright Gabor Szabo) Perl Training Israel | Next |
| Files in Perl6 | Up | Process a file line by line |