Hey Everyone,

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


In reply to Help with opening subdirectories by gzayzay

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.