<?xml version="1.0" encoding="windows-1252"?>
<node id="852379" title="Numification of strings" created="2010-08-01 20:35:08" updated="2010-08-01 20:35:08">
<type id="115">
perlquestion</type>
<author id="708738">
LanX</author>
<data>
<field name="doctext">
Hi&lt;P&gt;

what exactly is the application/motivation/benefit for the way perl numifies strings?&lt;P&gt;

&lt;c&gt;
  DB&lt;9&gt; $x="abc"
 
  DB&lt;10&gt; p 5 +$x
5
  DB&lt;11&gt; $x="2abc3"
 
  DB&lt;12&gt; p 5 +$x
7
&lt;/c&gt;&lt;P&gt;

BTW: This behaviour seems only to be documented for unary - in [doc://perlop]&lt;P&gt;

&lt;c&gt;
  DB&lt;18&gt; $x="ab2c3"
 
  DB&lt;19&gt; p -$x
-ab2c3
  DB&lt;20&gt; $x="6ab2c3"
 
  DB&lt;21&gt; p -$x
-6
&lt;/c&gt;

Isn't this behaviour mainly hiding ugly bugs?

&lt;!-- Node text goes above. Div tags should contain sig only --&gt;
&lt;div class="pmsig"&gt;&lt;div class="pmsig-708738"&gt;
&lt;p&gt;Cheers Rolf
&lt;/div&gt;&lt;/div&gt;</field>
</data>
</node>
