In a flat-file world, I think it depends what you plan to do with the data.
If you want to show all of the grades at the same time I would use a single text file and read each student to build the results. You can easily do comparisons, averages, search for grade ranges, etc. this way. You can also easily manually type up and edit this single text file.
If you want each student to access only his own grades I would use the multiple text files approach. Each student can also easily update information in his file this way, without reading and writing everything. Each file will have to have a unique name, but even if you implemented a retrieve by name function on a single text file you would have an issue if two student shared the exact same name. You should write a script to generate these multiple files from a master file, or even better, some sort or management script to oversee the creation and updating of the contents. This may be helpful:
sub readnames
{
opendir THISDIR, '../students';
@allnames = readdir THISDIR;
closedir THISDIR;
}
This passes all of the (file) names in the "students" directory to
@allnames where you can use it to update or delete the individual student files.
Either way, don't forget to lock your files with FLOCK.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.