Skip to content

Commit ca0e9b7

Browse files
authored
Harden example script to not crash on blank lines in input
http://colabti.org/irclogger/irclogger_log/perl6?date=2018-09-15#l465
1 parent bfe8f2d commit ca0e9b7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

doc/Language/101-basics.pod6

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ Here's one way to solve that problem in Perl 6:
3535
my %matches;
3636
my %sets;
3737
38-
for $file.lines -> $line {
38+
# The .grep(?*) portion filters out empty lines
39+
for $file.lines.grep(?*) -> $line {
3940
my ($pairing, $result) = $line.split(' | ');
4041
my ($p1, $p2) = $pairing.words;
4142
my ($r1, $r2) = $result.split(':');

0 commit comments

Comments
 (0)