Welcome to the Monastery, harishnv. I can't tell if your post was always empty or if you've removed its contents, but either way, please see How do I post a question effectively? for some guidelines on how to best ask questions. Normally, it'd be good if you include the code you have tried, how you expect it to behave, what is going wrong with it including exact error messages, and any other information so that we can reproduce the situation on our end, for example sample input and the expected output for that input. A question consisting of just the title is normally not enough information to go on. Please see How do I change/delete my post? for how to edit your node to include more information.

hey how to recursively access the directroies to search for a keyword and print its file name and the keyword line?

For recursively finding files, you could use the core module File::Find, or with a nicer interface File::Find::Rule. Then, for each file, you could open it, read it line-by-line, use a regular expression to find matches, and get the current line number from the special variable $.. Everything you need for that is explained in perlintro, pay particular attention to the description of foreach (for looping over a list of files) and the sections "Files and I/O" and "Regular expressions".


In reply to Re: hey how to recursively access the directroies to search for a keyword and print its file name and the keyword line? by haukex
in thread hey how to recursively access the directroies to search for a keyword and print its file name and the keyword line? by harishnv

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.