in reply to Re: using int and the range function
in thread using int and the range function

Also need to make sure there is nothing after the digits:

while (<>) { chomp; if (/^\d+$/) { print "$_ is an integer\n"; } }

Replies are listed 'Best First'.
Re^3: using int and the range function
by pme (Monsignor) on Jan 16, 2015 at 07:57 UTC
    We would also take into account sign or '0x' prefix for hexadecimal numbers. This way we will end up reimplementing Scalar::Util::looks_like_number() what AnomalousMonk suggested below.