in reply to "Cast" a wxString to Numeric?

Do you really want to treat the empty string as zero? If so, I would simply be more explicit about it:

my $numerator= $IcqText->GetValue; if( $numerator eq '') { $numerator= 0 }; $self->{AMP1}->Icq( $numerator / 1000 );

Replies are listed 'Best First'.
Re^2: "Cast" a wxString to Numeric?
by jmlynesjr (Deacon) on May 02, 2015 at 18:27 UTC

    Corion, thanks for your reply.

    Yes, I think I need to go with your suggestion. The event gets triggered every time the TextCtrl is modified and if you backspace until you erase the entire entry the value will end up "" which needs to be interpreted as 0 for my purposes.

    James

    There's never enough time to do it right, but always enough time to do it over...