Hey Thanks for the replies. My whole idea is that I have a folder called C:\myFolder which has some files. Now i want to scan each files' contents in this folder for a particular expression, say myExp.Process that expression and pick a word from it which is a file name. Then with this new file name (ex: a and append .txt to it), I have to search it in a list of directories that will be present in an array with me in perl. Check their presence and if they are present check for the above expression myExp2. Thus in a way there can be recursive search. For this if I scan line-by-line in a perl program then it will just slightly better than a C program. Hence i wanted to search the whole file initially with a command which will take an expression and search the whole file ,something like grep. Please help me on the same. Thanks in advance, Nishith

Original Question:

I want to do a grep like search in perl on windows platform.But I dont want to scan each line of a file for a particular expression.How can I do it. Please help. Thanks in advance. Nishith

Edit by castaway - original question restored.


In reply to Grep-Like Activity by nishith_dave

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.