1
2
3
choose_a_file( { show_hidden => 0, filter_re => qr{\.dat$}, ... } )
#
choose_a_file( { show_hidden => 0, filter_glob => '*.dat' } )
1 2 3 4 5 6
while ( my $file = readdir $dh ) { next if $file =~ /^\./ && ! $self->{show_hidden}; next if $file !~ /$filter_regex/; push @files, decode( 'locale_fs', $file ) if -f catdir $dir, $file; }
QuoteNote that they don't share the same prototype--CORE::glob() only accepts a single argument. Due to historical reasons, CORE::glob() will also split its argument on whitespace, treating it as multiple patterns, whereas bsd_glob() considers them as one pattern.