I am using perl+mdbm+sPRead to make things recently.
php has been used for a long time. I have used python and ruby. I have never touched the classic scripting language perl. Now I am reading the textbook like a primary school student.
I found that perl is indeed much more difficult. Nothing else makes me make mistakes so often.
1. The first common mistake is: outputting content to a file. The standard syntax is:
print STDERR "this is an apple.";
I usually write it as
print STDERR, "this is an apple.";
Always add an extra comma. To be honest, I rarely make mistakes repeatedly, but I just can't remember this one.
2. The second common mistake is: often missing the arrow referenced by Hash.
should be written as
print $hash->{$key};
I often write as
print $hash{$key};
3. The third common mistake is: String comparison:
After using PHP for a long time, I always use two equal signs to compare strings. This is wrong. The correct way to write it is
if($var eq "hello") {
}
The correct way is:
Print "yes";
} I often write if($var)print "yes";
5. There is another mistake, which is not brought from php, and most people probably won't make it: missing a semicolon.
The above is the content of 5 common errors in Perl. For more related articles, please pay attention to the PHP Chinese website (www.php.cn)!