gzayzay has asked for the wisdom of the Perl Monks concerning the following question:
I just started learning pearl last week and my first 10hrs with perl has been full with excitements. I am currently developing a search enigine with perl. However, I have reached to a point I thought with help from you all I will accomplish my task.
Firstly, Is there a way in perl that I can write two seperate scripts and call one in the other? if so, could someone kindly show me how to do that?.
Secondly, I am triying to crawl through directories to be able to open subfolders and files. however, using the "readir" and "opendir" command, I am only able to see the availble subdirectories but I cannot open them. Thus could someone kindly help me with that.
EAXMPLE. I have a folder called EDMAN located at C:\views\EDMAN. within EDMAN, there are subfolders call TEDDY, SAM, JOHN. all of which has multiple xml files with them. I can only see the folders TEDDY, SAM, JOHN using the readir and opendir command but I actually want to go into each of these folders and read the content of the xml file. I am still working on it but the below code is where I have gotten so far, thus can anyone kindly help me this ?
if (opendir(SEARCH, $path) && open(DATA,">$database")) { while (defined ($search = readdir(SEARCH))) { next if $search =~ /^\.\.?$/; if (!($search =~ /.xml|.txt|.zip|include/)) { print (DATA "$search\n"); } } closedir SEARCH ; }
Edit: g0n - code tags
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Help with opening subdirectories
by Praveen (Friar) on Feb 27, 2006 at 16:02 UTC | |
by Anonymous Monk on Feb 27, 2006 at 16:09 UTC | |
|
Re: Help with opening subdirectories
by philcrow (Priest) on Feb 27, 2006 at 16:00 UTC | |
|
Re: Help with opening subdirectories
by zer (Deacon) on Feb 28, 2006 at 05:40 UTC |