I'm sorry, i typed wrongly. i am new in learning perl. above is the right one.
still that question, i don't understand the function of "-?" and "?" above.
can any one help me? thanks!
检验数字表示合法性
if ($number =~ /^-?d+$|^-?0[xX][da-fa-F]+$/) {
print ("$number is a legal integer.n");
} else {
print ("$number is not a legal integer.n");
}
其中 ^-?d+$ 匹配十进制数字,^-?0[xX][da-fa-F]+$ 匹配十六进制数字。