1. Statement BLOCK:
The section between {} is block statement blocks.
2. Conditional statement:
if (expression) block;
if (expression)
BLOCK1
else BLOCK2;
if (expression1)
BLOCK1;
elsif (expression2)
BLOCK2;
Else
BLOCK3;
#Inverted if statement
Expression if (test_expression);
The relational operators involved:
numeric value Comparison: = = = =,, >=, <=,!=; note when comparing strings with numeric value comparison operators, the string is treated as 0;
String comparisons: eq, GT, lt, ge, Le, ne; (undef is treated as fake)
Logical operators: &&, | | |, and! ; and, or, not, and so on.
3. Cycle:
while (expression)
Block;
Todo
Block
while (expression);
for (initialization; test; increment)
Block;
foreach $each (@list)
Block;
4. Other
last: The final time, jump out of the current block, immediately following the block code down.
Next: This time, the next round of this block begins.
Label: similar to Goto.
Last and next are usually combined with if inverted statements or labels to achieve a jump.
Exit statement: Exit 0; End Current Perl program, return to OS;
Note: Perl does not have a switch statement, which is modeled using If-else.