Developer Forums | About Us | Site Map
Search  
HOME > TUTORIALS > SERVER SIDE CODING > PERL TUTORIALS > ROAD TO BETTER PROGRAMMING: CHAPTER 2. COMMENTING YOUR CODE


Sponsors





Useful Lists

Web Host
site hosted by netplex

Online Manuals

Road to better programming: Chapter 2. Commenting your code
By Teodor Zlatanov - 2004-02-11 Page:  1 2 3 4 5 6 7 8

Commenting the final stages of the program

In many ways, the end of the program is the most boring. The work has been done, the data structures have gone to sleep (there is no memory deallocation that you need to worry about in Perl), and now the end is just a few lines away. Don't let this fool you -- the finishing lines of a program can be just as perilous as the rest. Comment the most trivial lines here because the first thing a debugging programmer does is look at the program's exit behavior.

Listing 11


# delete old files, warn if they can't be removed
foreach (@myfiles)
{
 unlink $_ or warn "Couldn't remove $_: $!";
}
print "whodunit.pl is done!\n";         # tell the user we're done
exit;                                   # exit peacefully


View Road to better programming: Chapter 2. Commenting your code Discussion

Page:  1 2 3 4 5 6 7 8 Next Page: Writing POD documentation and help for the program

First published by IBM developerWorks


Copyright 2004-2017 GrindingGears.com. All rights reserved.
Article copyright and all rights retained by the author.