in reply to pushing

always "use strict" and enable warning. That would have found this problem immediately. You named one of your variables incorrectly. Your code should read (the change is in bold):

  @gb = <GB>; #where GB is a guestbook html file
  @gb2 = ("jsdjsjsj");
  foreach $line(@gb){
    push(@gb2,$line);
    if($line =~ /INSERT_NEW_ENTRY/){
      push(@gb2,"<b>entry</b> $FORM{'whatever'}");
    }
  }
  seek(GB,0,0);
  truncate(GB,0);
  print GB @gb2;

Replies are listed 'Best First'.
Re: Re: pushing
by pawel_guz (Novice) on Dec 30, 2000 at 18:44 UTC
    use strict -w; doesnt do anything!!

      I think you'll find they do if you read your error log!

      Try adding

      use CGI::Carp qw(fatalsToBrowser);

      to the script.

      --
      <http://www.dave.org.uk>

      "Perl makes the fun jobs fun
      and the boring jobs bearable" - me

      This problem is a great example of why use strict is such a lifesaver. But perhaps lhoward was overly subtle. He provided a corrected code fragment without calling attention to the correction.

      Read his code again, carefully. If necessary, copy/paste it into a file and diff it against your source.

      If you're already doing use strict and aren't getting any error messages, then there's a different type of programming lesson waiting for you as when you compare the code snippets.