>>>>> "JL" == Jonathan Lang <[EMAIL PROTECTED]> writes:
JL> Please. I've always found the "opendir ... readdir ... closedir" set JL> to be clunky. JL> Also: why distinguish between "open" and "opendir"? If the string is JL> the name of a file, 'open' means "open the file"; if it is the name of JL> a directory, 'open' means "open the directory". If it's the name of a JL> pipe, it opens the pipe. And so on. maybe this won't help you but if you did open on a dir in perl5 you can read the raw directory data which is pretty useless in most cases. so with open working as opendir on directories, what is the op/method to get the next directory entry? that isn't the same as reading a line. there won't be any trailing newlines to chomp. marking a location is not the same with tell and telldir (one is a byte offset, the other a directory entry index). and since dirs can reorder their entries (especially hash based dirs) the ordering and seek points may move. not gonna happen on text files. there are many differences and the only one you seem to see is a linear scan of them (which is just the most common access style). the operations you can do on the handles are very different as well. you can't write to a dir. dirs have no random access (you can lookup by a name with open but you can't go to the nth entry). and on OS with extra stuff like version numbers, then all bets are off. yes, you can tell the dir is such by doing a stat and then open can dwim but i don't see the overlap as you do. dirs generally are ordered lists of strings and have many different underlying formats based on their file systems. mapping that to a text file of lines doesn't work for me. this may all be obvious stuff but i think it deserves mentioning. if dirs mapped well onto file handles they would have been mapped that way long ago in the OS. in 30+ years that hasn't happened afaik. uri -- Uri Guttman ------ [EMAIL PROTECTED] -------- http://www.stemsystems.com --Perl Consulting, Stem Development, Systems Architecture, Design and Coding- Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org