We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 96af943 commit 7381d5dCopy full SHA for 7381d5d
categories/tutorial/01-word-wrap.pl
@@ -12,15 +12,15 @@
12
13
my $line_length = 50;
14
15
-my $tempfile = open('lorem.txt', :r);
16
-my $count = 0;
17
-for $tempfile.lines {
18
- $count++;
19
- lines(words($_));
+sub MAIN($input-file = $*SPEC.catdir($*PROGRAM-NAME.IO.dirname, "lorem.txt")) {
+ my $tempfile = open($input-file, :r);
+ my $count = 0;
+ for $tempfile.lines {
+ $count++;
20
+ lines(words($_));
21
+ }
22
}
23
-exit 0;
-
24
# Split a line into words (array)
25
sub words ($in) {
26
return $in.split(/\s/);
0 commit comments