http://qs321.pair.com?node_id=11109044


in reply to Converting to number doesn't always work...

Ignore my earlier useless reply please, for I had missed your effort to extract a number inside the obtuse print statement.

Per perlop ...

For example $x + $y is always a numeric addition, and if $x or $y do not contain numbers, an attempt is made to convert them to numbers first.

... int( 'a2' ), e.g., is converted to '0' because of leading non-number. You could parse the string yourself to extract a number.