Perl Style: Defensive Programming
- use strict
- #!/usr/bin/perl -w
- Check all syscall return values, printing $!
- Watch for external program failures in $?
- Check $@ after
eval""
or s///ee
.
- Parameter asserts
- #!/usr/bin/perl -T
- Always have an
else
after a chain of elsif
s
- Put commas at the end of lists to so your program won't break if someone
inserts another item at the end of the list.
Forward to The Art of Commenting Code
Back to Elegance
Up to index
Copyright © 1998, Tom Christiansen
All rights reserved.