看板 Perl 關於我們 聯絡資訊
※ 引述《heliosy (這一欄是要做啥用的)》之銘言: : 請問一下 : Perl中有沒有function可以判斷這個變數是否為數字呢? : 例如:isNumeric() 或 isNumber() : 之類的 : 謝謝 如果你不想自己寫 regex 或是你想比對的數字非常複雜 也許你可以使用官方套件 Scalar::Util 所提供的 looks_like_number() use Scalar::Util qw(looks_like_number); 或是安裝 Regexp::Common,使用它所提供的 number regex use Regexp::Common qw(number); 相關說明請參考: 1. http://perldoc.perl.org/Scalar/Util.html 2. http://search.cpan.org/dist/Regexp-Common/ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.230.178.185
heliosy:謝謝 :) 02/05 00:51