jeevs wrote:

 I am in need to write a script which will count the number of files
and directories in a given directory. It will also record the
statistics of the directory within the main directory.
   I have thought of a hash structure like
   %hash = {
        filecnt => value,
        dircnt => value,
        dir1 => {
                         filecnt => value,
                         dircnt => value,
                         dir1 =>{ ...}

                   },
           dir2 => {
                         filecnt => value,
                         dircnt => value,
                         dir1 =>{ ...}

                   },

   }

[snip]

My first thought is that your structure is very hard to get anything out
of once it's been built. What is your intention once you've gathered all
of this data?

Also, I assume 'dir1', 'dir2' etc. are the names of the directories?
What happens if a directory happens to be named 'filecnt' or 'dircnt'?

I recommend you think through this a little more before committing
yourself. You are likely to be more successful if your internal data
structure is a basis for the solution to the overall problem rather than
simply echoing the form of the source data.

HTH,

Rob

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to