控制结构
一、条件判断
if - elsif - else
二、循环
while
util
for
foreach
do - while
do - util
goto, last, next, redo
三、单行条件
语法为statement keyword condexpr。其中keyword可为if、unless、while或until,如:
print ("This is zero.\n") if ($var == 0);
print ("This is zero.\n") unless ($var != 0);
print ("Not zero yet.\n") while ($var-- > 0);
print ("Not zero yet.\n") until ($var-- == 0);
虽然条件判断写在后面,但却是先执行的。