in reply to how to make wildcard work in if (-e *..)

glob makes perl expand filenames with wildcards, just as the shell would, but I'm not sure if it'll do the trick here.

An alternative is to use something like:

opendir(DIR, "dir") or die "$!"; my @txt_files = grep {/\.txt$/} readdir(DIR); if (scalar @txt_files > 0) { #do stuff }

Cheers.

BazB

Update: Ooops. Fixed misplaced bracket.