Skip to content

Instantly share code, notes, and snippets.

@mishin
Created June 30, 2015 13:19
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 mishin/71aadf3559674b04f4d1 to your computer and use it in GitHub Desktop.
Save mishin/71aadf3559674b04f4d1 to your computer and use it in GitHub Desktop.
use v6;
=begin pod
=TITLE Get list of files matching a pattern
=AUTHOR stmuk
You want a list of filenames matching a pattern
=end pod
sub MAIN(:$dir = ".") {
my @perl-files = dir $dir, test => /\.pl/;
# returns a list of IO::Path objects
my $big_pl = "$dir/big.pl";
for @perl-files.sort -> $io {
my $contents = $io.basename.IO.slurp;
spurt $big_pl, $contents, :append;
say $io.basename;
say $contents;
}
}
# vim: expandtab shiftwidth=4 ft=perl6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment