Perl File::Glob

How the heck have I been using perl pretty much daily for almost 15 years and NOT seen File::Glob?!

There are several scripts that I have written over the years where I wanted to just grab certain files by name. I have done database calls to generate the names, I have used File::Find, I have written the script to just take the files as listed as arguments.

And it could have been soooo much simpler!

#!/usr/bin/perl

use strict;
use warnings;
use File::Glob;

my @txt_files = <*[.]txt>;

for my $file ( @txt_files ) {
    do_something( $file );
}

sub do_something {
    ....
};