How does this look:
It looks awful.
$foo++ # increment $foo
# Greet the user
print "Hello!\n";
If ($foo =~ /bar/) { # If $foo contains 'bar'
Don't comment what is obvious. Don't explain what code does. Explain algorithms, explain strange things. But don't insult the reader. If someone wants to know what a certain operator does, that someone should use the documentation.
Always assume that whoever reads source code either knows the language, or wants to learn it.
Further comments:
- Don't parse form fields yourself if you don't know how to. There are many modules that you can use for this.
- Don't send mail this way. As merlyn already pointed out, ione can easily use your script as an anonymous mailer.
- Don't leave unused subroutines around. It's confusing. If you really want to have the code around, comment it out.
- use strict and warnings.
- Use a module that sends e-mail. My favourite is MIME::Lite (despite its name, it can also send simple plain text messages).
- Learn Perl before writing scripts that are accessible publicly. It's okay to write bad code, but it is not okay to write bad code that others can abuse.
- Yes, I reinvent wheels.
- Spam: Visit eurotraQ.
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.