This approach does not consider "0" to be an integer. I'd use a RegEx and test to see if the string is made up entirely of integers. print "The variable containing $p is an interger\n" if ($p =~ /^[0-9]+$/);
On Tue, Mar 4, 2008 at 3:19 PM, Rodrick Brown <[EMAIL PROTECTED]> wrote: > #!/usr/bin/perl > > my $p = 10; > > if( int($p) ) { > print "$p is an interger\n"; > } > ~ > > > > > On Tue, Mar 4, 2008 at 3:16 PM, <[EMAIL PROTECTED]> wrote: > > Hi All, > > > > > > > > How to find out the specific variable contains integer value. In my > > script ,variable is storing some value but I want to find out whether > > that value is string or integer. > > > > > > > > Please help > > > > > > > > Regards > > > > Irfan. > > > > > > > > -- > Rodrick R. Brown > http://www.rodrickbrown.com > http://www.linkedin.com/in/rodrickbrown > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > http://learn.perl.org/ > > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/