On Wed, 16 Jan 2002 17:00:10 -0500, Ghana Dhungana wrote:

>    my $file;
>    my @globfiles;
>    my $filename ="junk.dbf" # or you can put your file name here.

This contains a dot.

>    #print "\nFor directory \"$parent\"\n";
> 
>        chdir($parent);
>        my @globfiles = <*>;

If prefer the syntax

        my @globfiles = glob("*");

> 
>        foreach $file (@globfiles) {
>                if (-f $file) {
>                        if ($file =~ /$filename/) {

And here you use it as a regex.

>                                print "DBF file/s : $parent\/$file\n";
>                        }
>                }
>                elsif (-d $file) {
>                         GetListing ("$parent/$file");
>                        
>                }
>        chdir($parent);
>        }
>}

This will also match "junkmorejunkodbfheh.jpg":

 - no anchoring of the regex
 - no metaquoting of the dot.

Why don't you just include the "pattern" in the glob?

        my @globfiles = glob("*.dbf");

This will list all .dbf files, but nothing else.

-- 
        Bart.

Reply via email to