anna_ajay has asked for the wisdom of the Perl Monks concerning the following question:

Dear All, I need to search a directory and list all the .html files. without using File:FInd module. Two program 1. Considering non-cyclic links. 2. Considering cyclic links. many Thanks Ann

Replies are listed 'Best First'.
Re: file search
by toolic (Bishop) on Mar 07, 2011 at 14:52 UTC
      thanks for the reply. It was a question for my project, that was checking my capability.I am learning perl from the scratch, a beginner. I used glob, but that gave me the array of files in the current directory, or the directory which I have passed to the glob function, it is not giving me the files in the sub directory. How do i do that?. i need to search for all the files in the disk, and need to push the files into an array,then take the files for processing. I need to avoid cyclic links, but didn't get the idea how to check the cyclic link? Also i need to find a way without recursion?. please guide me
        it is not giving me the files in the sub directory. How do i do that?

        As per toolic's reply, use opendir/readdir.

        I need to avoid cyclic links, but didn't get the idea how to check the cyclic link?

        Have a look at readlink.

        Also i need to find a way without recursion?

        Any other restrictions? Can we use computers? Recursion is the only by far the most sensible approach when dealing with an arbitrary depth of sub-directories.

        Update: Slightly toned down the recursion encomium!

        Cheers,

        JohnGG