[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] Bad Subroutine



I have this subroutine in a program of mine for the web that's just not
working.  What it's supposed to do is, open a file, find the line that
reads <!--$first_next-->Not Posted Yet and then put
<!--$first_next-->$subject<!--end$first_next--> in it's place.  But
instead, it prints <!--$first_next-->$subject<!--end$first_next--> and
erases over everything else in file.  Anyone know how to fix this?  The
subroutine is below.

Matt Kraft

sub first_prev_page {
   open(FIRST,"$basedir/$mesgdir/$first_prev\.$ext") || die $!;
   @first = <FIRST>;
   close(FIRST);

   open(FIRST,">$basedir/$mesgdir/$first_prev\.$ext") || die $!;
   if ($followup == 0) {
      foreach $first_line (@first) {
         if ($first_line =~ /<!--$first_next-->Not Posted Yet/) {
	print FIRST "<!--$first_next-->\n";
	print FIRST "$subject\n";
	print FIRST "<!--end$first_next-->\n";
            }
	}
    }
   close(FIRST);
}



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch