www.ugnews.info

if鏂囥缍氥亶

銇婂墠銇銇綍鑹层仩銆併亾銈撱伆銈撱伅ugnews銇с仚銆
銇撱仾銇勩仩銇甶f鏂囥亴銇俱仩銇°倗銇c仺娈嬨仯銇︺亜銇熴伄銇с仢銈屻倓銇c仧銆傘優銉嬨儱銈€儷浜洪枔銇犮仐銆佹湰閫氥倞銇倓銇c仸銇勩亱銇亜銇ㄤ笉瀹夈仩!!

銇俱仛銇佹暟銇瘮杓冦仺鏂囧瓧鍒椼伄姣旇純銆傛枃瀛椼仺銇椼仸姣旇純銇欍倠銇嬨佹暟銇ㄣ仐銇︽瘮杓冦仚銈嬨亱銆12銇9銇牬鍚堛佹暟銇ㄣ仐銇︺伩銈屻伆12銇柟銇屻仢銈娿們澶с亶銇勩亼銇┿佹枃瀛楀垪銇ц銈嬨仺9銇柟銇屽ぇ銇嶃亜銇ㄣ伩銇仌銈屻倠銆傜悊鐢便伅銆12銇渶鍒濄伄1銇屻1銆嶃仺銇椼仸瑙i噲銇曘倢銇︺仐銇俱亞銇嬨倝銆傘伨銇傛暟銇ㄦ枃瀛楀垪銇瘮杓婕旂畻瀛銇〃銇銇撱亾銇ㄣ亱瑕嬨仸銇忋仩銇曘亜銆

銇撱亞銇勩亞銇倰鏇搞亜銇熴

my $a = 12;
my $b = 9;

# 銇濄伄1
if ($a > $b) {
	print "$a > $b\n";
} else {
	print "$a le $b\n";
}

# 銇濄伄2
if ($a gt $b) {
	print "$a gt $b\n";
} else {
	print "$a le $b\n";
}

gt 銇ㄣ亜銇嗐伄銇$a銇$b銈堛倞澶с亶銇勫牬鍚堛亴鐪熴伀銇倠鏉′欢寮忋傚疅琛屻仚銈嬨仺銇撱亞銇倠銆

12 > 9
12 le 9

銆屻仢銇1銆嶃伄鏂广亴銆佺湡銇柟銇祼鏋溿仹鍑恒倠銇伅銇濄伄銇俱倱銇俱仩銇戙仼銆12 > 9銆嶃仩銇嬨倝銆傘屻仢銇2銆嶃伄鏂广伅銆佽鏄庛仐銇熴仺銇娿倞銆1銇ㄣ仐銇﹁В閲堛仌銈屻仭銈冦仯銇︺倠銇嬨倝銆1 > 9銆嶃仺銇倠銈忋亼銆傘仹銆9銇柟銇屽ぇ銇嶃亜銈忋亼銇у伣銇柟銇 $a le $b 銇屽疅琛岀祼鏋溿伀琛ㄧず銇曘倢銈嬨


鈥曗曗曗曗曗曗曗曗曗曗曗曗曗曗曗曗曗曗曗曗


娆°伅銆佹暟銇屽叆鍔涖仌銈屻仧銇亱鍒ゆ柇銇欍倠銉椼儹銈般儵銉犮

my $line = <STDIN>;				# 銉︺兗銈跺叆鍔
chomp($line);					# 鏀硅銈掑彇銈婇櫎銇
if ($line =~ /^\d+$/) {				# 鏂囧瓧鍒楋紵
	print "$line銇暟瀛楀垪銇!!\n";		# 銇亜!!
} else {
	print "$line銇枃瀛楀垪銇с伅銇亜!!\n";	# 銇勩亜銇
}

瀹熻銇欍倠銇ㄣ併亾銈撱仾鎰熴仒銇仾銈嬨

1111
1111銇暟瀛楀垪銇!!

鏁板瓧浠ュ銈掑叆鍔涖仚銈嬨仺銆

unko
unko銇枃瀛楀垪銇с伅銇亜!!

銇ㄥ嚭銈嬨傛潯浠跺紡銇浉銇嬨倢銇︺倠 $line =~ /^\d+$/ 銇ㄣ亜銇嗐伄銇併仾銈撱亱鑹层呮浉銇嬨倢銇︺倠銆傘倎銈撱仼銇涖亪銆傘仾銈撱亱銆屻亾銇紡銇┏銇椼亜鎰忓懗銇7绔犮仹瀛︺伋銇俱仚銆嶃仺銇嬫浉銇嬨倢銇︺倠銇椼傘伨銇犵3绔犮仾銇仹瑭炽仐銇勩亾銇ㄣ伅銇勩仛銈屾浉銇忋仺鎬濄亜銇俱仚銆


鈥曗曗曗曗曗曗曗曗曗曗曗曗曗曗曗曗曗曗曗曗


銈優銈便銆銉囥儛銉冦偘銉椼儶銉炽儓銇埗寰°

if鏂囥倰浣裤仯銇銉囥儛銉冦偘銉椼儶銉炽儓銇湁鐒°倰鍒囥倞鏇裤亪銈夈倢銈嬨倛銇嗐伀銇欍倠銇伅銆

my $debug = "1";

if ($debug) {
	print "銇嗐倱銇撱亞銈撱亾\n";
	print "銇嗐倱銇撱亞銈撱亾\n";
}

銇傘倠銇勩伅銆

print "銇嗐倱銇撱亞銈撱亾\n" if ($debug);

銇╥f淇>瀛愩儮銉笺儔銇ф浉銇勩仸銇裤倠銇

銇嗐倱銇撱亞銈撱亾
銇嗐倱銇撱亞銈撱亾

銇ㄥ嚭銇俱仚銆傚ぇ渚裤亴鐖嗙櫤銇欍倠銆傘仹銆併亾銇 $debug 銇ゃ倰0銇仚銈嬨仺銉囥儛銉冦偘銉椼儶銉炽儓銈掔劇鍔广伀銇с亶銈嬨傘亾銈屻伅渚垮埄銇倛銇嗐仾姘椼倐銇欍倠銇戙仼銆併仼銇嗐亜銇嗐仺銇嶃伀浣裤亪銇般亜銇勩伄銇嬨仭銈囥仯銇ㄣ償銉炽仺銇撱仾銇勩仾銉笺傘仧銇俱仧銇炬浉銇勩仸銇熴儣銉偘銉┿儬銈掑疅琛屻仐銇熴仺銇嶃伀銈ㄣ儵銉笺亴鍑恒仧鍫村悎銆併亾銇ゃ倰0銇仐銇︺亰銇忋仺闁撻仌銇c仸銈嬮儴鍒嗐倰鎺€仐銈勩仚銇忋仾銈嬶紒銇ㄣ亱銇濄倱銇倱銇с亜銇勩伄銇嬨仾銆傘仹銈傘併仢銈屻仩銇ㄣ亜銇°亜銇 print 銇屻亗銈嬨仺銇撱倣銇痠f鏂囥仹鎷仯銇︺亰銇嬨仾銇嶃們銉銉°仾銈撱仒銈冦仾銇勩伄銇嬨傘亞銉笺個銆


鈥曗曗曗曗曗曗曗曗曗曗曗曗曗曗曗曗曗曗曗曗


銇层仺銇俱仛銇撱亾銇俱仹銆傘亾銇儣銉偘銉┿儬銈掓浉銇勩仸銆併仢銈屻倰銇撱亞銇椼仸銉栥儹銈般伀鏇搞亸銇俱仹銇1鏅傞枔銇嬨亱銇c仧鈥︺

娆°伅绗4绔犮岄厤鍒椼仺銉偣銉堛嶃倰銈勩倠銈堛