on Thu, 13 Feb 2003 00:21:03 GMT, [EMAIL PROTECTED] (Gan Uesli
Starling) wrote: 

> Am wanting to get a list of files in a directory, but only
> files which are not themselves further sub-directories.
> 
> When I do this...
>      
>    opendir(DIR, $this_path) or die "Can't opendir $this_path: $!";
>    @file_list = glob("*");
>    closedir(DIR);
> 
> ...it gives all the files, including the files which are also 
> directories. 

The 'glob' function has nothing to do with the 
'opendir/readdir/closedir' functions.

Try this:

    opendir DIR, $this_path;
    my @file_list = grep { -f } readdir DIR;
    closedir DIR;

See
    perldoc -f -X

for the filetest operators/functions.

-- 
felix   

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to