in reply to Re: Please help me understand string eval better
in thread Please help me understand string eval better

perl does not consider '09' to be a number

Perl does consider the string "09" to be a number, 0 + "09" == 9. The only question is, does the OP want this to be interpreted as an octal, which in this case would be invalid, or not.

$ perl -wMstrict -le 'print 77' 77 $ perl -wMstrict -le 'print 077 ' 63 $ perl -wMstrict -le 'print 0 + "077"' 77 $ perl -wMstrict -le 'print oct "077"' 63 $ perl -wMstrict -le 'print eval " 77"' 77 $ perl -wMstrict -le 'print eval "077"' 63
if (looks_like_number($$var)) { print "$$var is not a number\n";

You've got mistake in your logic there. Also note that looks_like_number tells you whether the string will properly auto-convert to a number (0+$str), but does not cover all of the numeric literals that Perl accepts in its source code, i.e. what eval will parse, such as 0b1001 or 1234_56; strings like "0b1001" won't automagically convert to numbers. I wrote about this a bit more at Re^3: why are hex values not numbers?