use Path::Tiny qw/ path /; print "$_\n" for path('.')->children( qr /^messages(?:\.\d?)?$/ ) ;