in reply to way of declare an integer variable instead use /^\d+$/
use Types::Common qw( Int ); tie my $x, Int; $x = 5; $x += 1; print $x, "\n"; # prints "6" $x = "7"; # this is fine, even though it's quoted $x += 0.5; # dies because 7.5 isn't an integer
|
---|