Created
June 30, 2015 13:19
-
-
Save mishin/71aadf3559674b04f4d1 to your computer and use it in GitHub Desktop.
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
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