in reply to Find a list of numbered files with same basename

if they are all on the same directory then you don't need File::Find, just use glob:
my @file_names=glob 'db.table.[0-9][0-9]';

Replies are listed 'Best First'.
Re^2: Find a list of numbered files with same basename
by 5mi11er (Deacon) on Apr 22, 2005 at 15:35 UTC
    Using glob makes it very simple to generalize this to find any pattern you want.
    my $pattern = "*.[0-9][0-9]"; my @file_names = glob $pattern;
    for instance, would find all files that ended with a double digit number.

    To bad the glob format isn't quite as nice as the full regular expression engine, I'd have liked to be able to do \d+, but without further complicating this, we can't.

    -Scott

      Why is this not returning anything? The files exit the format is correct but glob does not populate the array.
      sub find_files{ my ($dir, $db, $table) = @_; my $file = "$dir" ."/" . "$db.$table.[0-9][0-9]"; print "$file\n"; my @files = glob $file; foreach my $found_file (@files){ print "$found_file\n"; } return @files; }
        we need to know how you are calling find_files and your dir structure to see what's going wrong. What's the output from the 'print "$file\n"' line?