"be consistent" | |
PerlMonks |
Re: Read/write file in CGI Perlby mr_mischief (Monsignor) |
on May 06, 2014 at 14:42 UTC ( [id://1085193]=note: print w/replies, xml ) | Need Help?? |
It will be very difficult to complete the code without seeing it in its current form. However, I can offer hints. If you read the HTML or XHTML documentation it will make clear that a form field can have an initial value set. If you are using a JavaScript library like jQuery or YUI your JavaScript library has a way to set these through the DOM, or you can do it with JavaScript directly. You can also have your Perl code dynamically write the HTML with the values already set. Some modules, such as CGI have ways to do that, as do the frameworks and toolkits for web work. As for opening and reading a file, there's open and then many ways to read. The readline ( '<>' ) is a good way to read a file. One might also use a structured file via XML like with the XML::Simple or XML::Twig modules; via CSV; via JSON, YAML, or INI, or using dbm. One could also use a database via the DBI or a similar module (DBI). You could then use a database backend like SQLite, DBD::mysql, DBD::Pg. or many others (DBD). There are database-like interfaces between the DBI and files like DBD::CSV or DBD::RAM if you want, but a real database may be better in the long run.
In Section
Seekers of Perl Wisdom
|
|