A document is a file of some sort that cantains a collection of information. It can exist as an HTML, Word, Plain text, or an oodle of other file types.

Document (verb) Edit

To document something in perl, you usually add a #comment that explains what you just did with your code like this:

#30 day months

The text after the # is commented out and ignored by the perl interpretor, but you've explained to others looking at your code that @Months30 represents the months that have thirty days.

Sample code and documentation Edit

You can similarly document a block of code like:

if ($leapyear) {$MonthDaysFeb=29}
else {$MonthDaysFeb=28}


foreach $month (@Months) {
 chomp $month;
  unless ($month=='Feb') {
   unless (@Month30) {
   else %MonthDays=($month=>(1..30)}
  else %MonthDays=($month=>(1..28)}

Now the coder can explain at least what he or she is trying to do with some plain old documentation called pod text which appears to humans reading the code bit not to the compiler:


 The code above is for putting
 together a calendar year with 
 three-letter $month names and
 a hash for the numbered days of
 each month, allowing for leap
 year 'Feb's and @Months30,
 which have only 30 days.

 %Year should now contain all
 365 or 366 days placed within
 their respective @Months.

 I don't know if this is the
 right way to do it or not but,
 hey. I'm trying!


Why document your code? Edit

Failing to document your code is somewhere between ignorant naivety and lazy arrogance. Learning to document code is as important as learning to write and debug it. In software development, documentation starts at even the most primative levels.

Expert coders who document their code in a thoughtful manner, stand a better chance of getting quality feedback from their less-experienced peers. By the same token, novice coders stand a better chance of getting help from the experts if they put forth an effort to explain what they are attempting.

Document types Edit


Documentation Edit

See Category:Documentation

Master Documents Edit

See Category:Master documents

Community content is available under CC-BY-SA unless otherwise noted.