Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env perl6
- use v6;
- use File::Find;
- sub MAIN(Str :$pattern = '')
- {
- my $files = find(:dir('.'), :type('file'));
- say "Found {@$files.elems} file(s) before filtering";
- my Int $matches = 0;
- if $pattern eq ''
- {
- say "All files are matching";
- return;
- }
- for @$files -> $file
- {
- if $file ~~ /$pattern/
- {
- say "Match: {$file}";
- $matches++;
- }
- }
- say "Found {$matches} matches for /{$pattern}/";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement