Skip to content

Instantly share code, notes, and snippets.

@nd3i
Created May 2, 2016 22:36
Show Gist options
  • Save nd3i/03750ed3a67a2c0368773c127d165e6a to your computer and use it in GitHub Desktop.
Save nd3i/03750ed3a67a2c0368773c127d165e6a to your computer and use it in GitHub Desktop.
use v6;
sub MAIN (:$sep = "\t", :$min = 0) {
my ($lines, $words, $chars) = 0 xx 3;
for lines() -> $l {
$lines += 1;
$chars += $l.chars + 1;
$words += $l.subst(/<-alpha -space>/,'',:g).words.grep(*.chars >= $min);
}
say ($lines, $words, $chars).join($sep);
}
@smls
Copy link

smls commented May 2, 2016

Try this:

sub MAIN (*@files, :$sep = "\t", :$min = 0) {
    @*ARGS = @files;

    # ....rest as before
}

Or more concisely, at the risk of confusing readers:

sub MAIN (*@*ARGS, :$sep = "\t", :$min = 0) {
    # ....rest as before
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment