use warnings; use strict; use Tk; use Devel::Peek; my $scale = '22.5 '; # note the space in the output as well my $foo = 0 + $scale; # use in numeric context (set NV and IV) Dump($scale); my $mw = MainWindow->new; $mw->Entry(-textvariable=>\$scale)->pack; $mw->bind("",\&calc); calc(); MainLoop; sub calc { print "str: <$scale> / num: <".(0+$scale)."> \n"; } #### SV = PVNV(0x1e3f350) at 0x1e59a40 REFCNT = 2 FLAGS = (NOK,POK,IsCOW,pIOK,pNOK,pPOK) IV = 22 NV = 22.5 PV = 0x1e6f870 "22.5 "\0 CUR = 5 LEN = 10 COW_REFCNT = 1 str: <22.5 > / num: <22>