next up previous contents
Next: 迴圈控制 Up: 條件敘述 Previous: 條件敘述   Contents

條件比較

shell
	字串
	[ "str1" = "str2" ]
	數值
	[ num1 -ne num2 ]
perl
	字串
	if ($str1 ne $str2)
	數值
	if ($num1 == $num2)
C
	字串
	if (strcmp(str1, str2))
	數值
	if (num1 == num2)
要注意數值比較,字串比較,字串處理與邏輯比較。 由這邊我們可以看出其實perl是非常有彈性與強大的。



Cyril Huang 2002-06-14