Again I need your wisdom to solve the problem. I am trying to substitute a particular word in HTML file with a HREF word. The problem is when the file 0071.html is created it has the contents of the previous file. What i need is that for the first time when it finds the file 3800-128.html it should parse and then write into the file 0071.html then when it encounter the other file 3800-129.html it should delete the content of 3800-128.html and overwrite it but the problem is that first it print the contents of 3800-128.html and then it print the contents of 3800-129.html and so on. Please help me
#!perl/bin/perl -w print "Content-type: text/html\n\n"; use LWP::Simple; use HTML::TokeParser; $q=128; while ($q < 132 ) { open(FILE, "<D:/MON/3800-$q.html"); while (<FILE>) { $data1 .= $_; } close (FILE); $sid = &sid12($data1); open (MYFILE, '>0071.html'); print MYFILE "$sid<br>"; close (MYFILE); print "$sid<br><br><br>"; sub sid12{ my $htmls = $_[0]; $htmls =~ s/onClick/HREF/isg; return $htmls; } close (FILE); unlink("0071.html"); $q++; }

In reply to Unknown File Operation by parshtml

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.