本帖最后由 lllsoslll 于 2011-11-2 23:47 编辑
第三章 基本控制结构- # "<",">",">=","<=","==","!=": 数字 比较。
- # "eq","lt","gt","le","ge","ne" : 字符串 比较。
- if($a<$b) {print $a; }
- print $a if ($a<$b);
复制代码
- if (!($a < 3)) ...
- 等价于
- unless($a<3)
复制代码
- while ($a<0) {print $a;}
- print $a while ($a<0);
复制代码
- for (语句; 条件表达式; 语句;) {语句;}
- for (1 ... 10) print $_;
- print for (1...10);
- print foreach (@array);
复制代码
|