Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
use v6; | ||
|
||
=begin pod | ||
=TITLE Count File Lines | ||
=AUTHOR stmuk | ||
You want to count the number of lines in a file | ||
=end pod | ||
|
||
my @lines = $*PROGRAM-NAME.IO.lines; | ||
|
||
say @lines.elems; | ||
|
||
# vim: expandtab shiftwidth=4 ft=perl6 |
20 changes: 20 additions & 0 deletions
20
categories/cookbook/08-file-contents/08-03-process-words.pl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
use v6; | ||
|
||
=begin pod | ||
=TITLE Process every word in a file | ||
=AUTHOR stmuk | ||
You want to process every word in a file | ||
=end pod | ||
|
||
my @words = $*PROGRAM-NAME.IO.words; | ||
|
||
for @words -> $word { | ||
dd $word; | ||
} | ||
|
||
|
||
# vim: expandtab shiftwidth=4 ft=perl6 |
20 changes: 20 additions & 0 deletions
20
categories/cookbook/08-file-contents/08-04-read-file-lines-backwards.pl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
use v6; | ||
|
||
=begin pod | ||
=TITLE Read file lines backwards | ||
=AUTHOR stmuk | ||
You want to read file lines backwards | ||
=end pod | ||
|
||
my @lines = $*PROGRAM-NAME.IO.lines; | ||
@lines .= reverse; | ||
|
||
for @lines -> $line { | ||
dd $line; | ||
} | ||
|
||
# vim: expandtab shiftwidth=4 ft=perl6 |