Link to home
Start Free TrialLog in
Avatar of JavaBloggs
JavaBloggs

asked on

Appending to a file...

 I am currently using a perl script to store form data on a server, it keeps all the data by first opening the file and reading out all the data then printing it all back in, plus the new line at the bottom... (very sad I know...) like this:

      open(BUFFER,"<$MBUKstor") or explode ("Cannot open $MBUKstor at line 25 - $!");
            push @lines, <BUFFER>;
      close(BUFFER);

      open(STORE,">$MBUKstor") or explode ("Cannot open $MBUKstor at line 29 - $!");
            foreach $line (@lines) {
                  print STORE "$line\n";
            }
            print STORE "$FORM{'name'} |:| $FORM{'email'} |:| $FORM{'postcode'} |:| $FORM{'conly'}\n";
      close(STORE);

But I want to just print the new line at the end of the file, what is the code to append to the end of the file???

Regards
JB

ASKER CERTIFIED SOLUTION
Avatar of Paul Maker
Paul Maker
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of JavaBloggs
JavaBloggs

ASKER

 Cheers for that, I know its not worth 300 pts, but I was in a hurry and left my books at home....

  Thanks again