aboutsummaryrefslogtreecommitdiff
path: root/challenge-024/fjwhittle/perl6/ch-2.p6
blob: 1b0dc9bb6e60afb362b8c0006722a2260ae5b533 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
unit sub MAIN (*@file);

my %index;

for @file.map(*.?IO).grep({.?f && .?r}) -> $file {
  %index.push:
    $file.comb(/\w+/, :match).hyper.map({ .Str.fc => $($file.path => .pos,) });
}

while my $word = prompt 'Find? ' {
  %index{$word.fc}».say;
}