> another way is to use a regex and check if the var only > consists numbers: > > if ($var1 =~ /^\d+$/) { > print "is int\n"; > } else { > print "not int" > }
How about -7 or 5.0? Both are integers. Wouldn't it be better for him to use one of the answers in the FAQ? http://www.perldoc.com/perl5.6.1/pod/perlfaq4.html - How do I determine whether a scalar is a number/whole/integer/float? -- Mark Thomas [EMAIL PROTECTED] Internet Systems Architect User Technology Associates, Inc. $_=q;KvtuyboopuifeyQQfeemyibdlfee;; y.e.s. ;y+B-x+A-w+s; ;y;y; ;;print;; _______________________________________________ Perl-Unix-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs