一、if语句
例如:
二、while语句
例如:
例如:
if ($name gt 'fred') {
print "'$name' comes after 'fred' in sorted order.\n";
}
同样也有else:if ($name gt 'fred') {
print "'$name' comes after 'fred' in sorted order.\n";
} else {
print "'$name' does not come after 'fred'.\n";
print "Maybe it's the same string, in fact.\n";
}
二、while语句
例如:
$count = 0;
while ($count < 10) {
$count += 2;
print "count is now $count.\n"; # 程序将依次打印出2, 4, 6, 8, 10
}