#!/usr/bin/env perl use utf8; use 5.14.2; # for s///r use strictures; use Template; use Path::Tiny; # Mocking… you'd replace with your actual routine. sub Path::Tiny::textify { # Monkey patch. my $self = shift; join " ", map ucfirst, split /[\W_]/, $self->basename =~ s/(?<=\w)\.\w{1,3}\z//r; } my $tt2 = Template->new; my @files = grep $_->is_file, path(".")->children( qr/\A[A-Z].+/i ); # Should probably have \z too. $tt2->process(\*DATA, { files => \@files }) or warn $Template::ERROR; __DATA__