Perl 6 Perl 6 today #45

Basic I/O

Use .get to obtain a single line of input

my $line = $fh.get;

Note that these probably don't do what you want / expect:

for $fh.get -> $line { ... }     # reads 1 line, iterates once

while $fh.get { say $_; }        # stops on first false line

Generally for iterating over a file, use for and .lines

Copyright © 2009
http://www.pmichaud.com/2009/pres/