in reply to Re: Re: Re: pushing
in thread pushing

this is my whole section in trouble:
open (GB, ">>guestlog2.htm") or die "cant open data file: $!\n"; flock(GB, 2) or die "can't LOCK_EX data file: $!"; @gb = <GB>; @gb2 = ("dgfdhgfdhgfdh"); foreach $line (@gb) { push (@gb2,$line); if($line =~ /INSERT_NEW_ENTRY/g){ push (@gb2,"<b>Name:</b> $FORM{'Name'}\r<p>\r<b>Date:</b> <i>E +RROR! Notify Me!</i>\r<p>\r<b>E-mail Address:</b> <a href=\"$FORM{'em +ailaddress'}\">$FORM{'emailaddress'}</a>\r<p>\r<b>Comments:</b> $FORM +{'Comments'}\r<hr>\r"); } } seek (GB, 0, 0) or die "can't rewind $data_file: $!"; truncate(GB,0); print GB @gb2; close (GB) or die "can't close data file: $!";

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: pushing
by davorg (Chancellor) on Dec 30, 2000 at 18:56 UTC

    You're opening the file for writing, but trying to read from it. Therefore your @gb array gets no data when you do:

    @gb = <GB>;

    Try opening the file for reading (or read/write) and see if it makes a difference.

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

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

Re: Re: Re: Re: Re: pushing
by extremely (Priest) on Dec 31, 2000 at 12:11 UTC
    In this line, if($line =~ /INSERT_NEW_ENTRY/g){ there is no need for the "g".

    --
    $you = new YOU;
    honk() if $you->love(perl)