I'm doing something with Perl+mdbm+spread recently.
PHP has been used for a long time, Python and Ruby have been used, the classic scripting language has not been touched by Perl, now in the same way as a pupil holding a textbook gnawing.
It's a lot harder to find Perl. Something else didn't make me make a mistake so often.
1. The first common mistake is to output content to a file. The standard syntax is:
Print STDERR "This is an apple."
I usually write
Print STDERR, "This is a apple.";
Always play a comma more. Frankly speaking, I rarely make mistakes repeatedly, but I just can't remember this place.
2. The second common error is: Often omitting the arrows that hash references.
Should have been written
Print $hash->{$key};
I often write
Print $hash {$key};
3. A third common error is: string comparisons:
Use PHP for a long time, always using two equals sign to compare strings. This is wrong. The correct wording is
if ($var eq "Hello") {
print "World";
}
I often write:
if ($var = = "Hello") {
print "World";
}
This can lead to logic errors that are difficult to find.
4. A fourth common error:
If statement with no parentheses (all PHP bad)
The correct wording is:
if ($var)
{
print "yes";
}
I often write
if ($var)
print "yes";
5. There is also a mistake, not from PHP brought over, the average person will not commit: the omission of a semicolon.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.