Text or Number

Sisyphus kalinabears at iinet.net.au
Sun Mar 28 14:51:21 CST 2004


Joshua Goodall wrote:

> 
> Scott is writing parallel port driver, and some API users confuse
> ascii '1' (binary 0001111) with the actual value 00000001.  This can
> result in more parallel lines being set than expected :).  By detecting
> that the API user actually used a literal 1, you can implement a
> DWIM handler internally e.g. using pack().
> 

But normally perl does this "DWIM" stuff for you.
If I write:

$x = "1";
$y = $x * 3;

then $y always holds the value 3, not 45.

How does perl's own DWIM handler come to fail for Scott ?

Cheers,
Rob




More information about the Melbourne-pm mailing list