Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
This is how my program looks like now. I tried this but the grep here is not returning right value, its returning 1 as if its matching all the time.

#!/usr/bin/perl -w
open(MATCH_PATTERN,"< temp1");
open(FILE_TO_LOOK,"< temp2");
open OF, "> temp3";

while ($m =<MATCH_PATTERN>)
print "reading the current text to match \n $m \n";
seek (FILE_TO_LOOK ,0, 0);
while ($l= <FILE_TO_LOOK>) {
print "reading the textline to look for match \n $l \n";
@found = grep ($m, $l) ;
$match = @found;
if ($match == 1)
print "now the match is \n $match \n";
print OF "#$l";

close OF;

In reply to Re^2: how to comment the lines if found a match by kavitha
in thread how to comment the lines if found a match by kavitha

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

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2023-11-30 04:06 GMT
Find Nodes?
    Voting Booth?

    No recent polls found