in reply to Re: Converting to number doesn't always work... (updated)
in thread Converting to number doesn't always work...
For both of those one liners, Scalar::Util::looks_like_number($x) returns a false value, but it's only the second one liner that warns when $x is used in numeric context.C:\>perl -MScalar::Util="looks_like_number" -wle "$r = ''; $x = \$r; p +rint 'lln' if looks_like_number($x); $x += 1" C:\>perl -MScalar::Util="looks_like_number" -wle "$x = 'hello'; print +'lln' if looks_like_number($x); $x += 1" Argument "hello" isn't numeric in addition (+) at -e line 1. C:\>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Converting to number doesn't always work... (updated)
by haukex (Archbishop) on Nov 22, 2019 at 09:15 UTC | |
by syphilis (Archbishop) on Nov 22, 2019 at 12:18 UTC | |
by haukex (Archbishop) on Nov 22, 2019 at 13:04 UTC | |
by syphilis (Archbishop) on Nov 22, 2019 at 13:31 UTC |