----- Original Message -----
From: "Thomas_M" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Thursday, January 30, 2003 2:35 PM
Subject: RE: determining if a scalar is an integer or not
> > 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.
Integer, you say? How about something real trivial, not using regex, like
"int ()"? :)
$a = '77';
if (int ($a)) {
print "Yes\n";
} else {
print "No\n";
}
- Mark
System Administrator Asarian-host.org
---
"If you were supposed to understand it,
we wouldn't call it code." - FedEx
_______________________________________________
Perl-Unix-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs