Skip to content

Commit f5f22d3

Browse files
committed
add a p6 translation under glob
1 parent e2d6ed7 commit f5f22d3

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lib/Language/5to6.pod

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ method call syntax now uses a dot instead of an arrow:
5353
$person.name # Perl 6
5454
5555
The dot notation is both easier to type and more of an industry standard.
56-
But we also wanted to steal the arrow for something else.
56+
But we also wanted to steal the arrow for something else. (Concatenation
57+
is now done with the C<~> operator, if you were wondering.)
5758
5859
=head3 Whitespace
5960
@@ -282,6 +283,15 @@ before translating into Perl 6.
282283
open my $in_file, '<', $path or die;
283284
my ($line1, $line2) = read_2($in_file);
284285
286+
And here's just one possible Perl 6 translation:
287+
288+
# Perl 6
289+
sub read-n($fh, $n) {
290+
return $fh.get xx $n;
291+
}
292+
my $in-file = open $path or die;
293+
my ($line1, $line2) = read-n($in-file, 2);
294+
285295
=head3 Reference creation
286296
287297
In Perl 5, references to anonymous arrays and hashes and subs are returned

0 commit comments

Comments
 (0)