Skip to content

Instantly share code, notes, and snippets.

@lizmat
Created May 12, 2020 13:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lizmat/ca60dd89924260117ddd1ec1dd1128f4 to your computer and use it in GitHub Desktop.
Save lizmat/ca60dd89924260117ddd1ec1dd1128f4 to your computer and use it in GitHub Desktop.
Another solution
my %b is Bag = "aa.txt".IO.lines.map: -> $line {
my int @evenodd = 0,0;
++@evenodd[$_ % 2] for $line.words.skip(2).head(5);
@evenodd.join(" ");
}
for %b.sort -> (:$key, :$value) {
say "$key --> $value"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment