in reply to Argument "On" isn't numeric in subroutine entry
I've not used the Win32::GUI stuff, but I suspect that pre_mute_button_Click() is called as a button click handler. Very likely the calling code expects a numeric value returned from your sub. However that's not wat is returned. The following may be instructive:
print pre_mute_button_Click(); sub pre_mute_button_Click { $PreMute = "xxx"; if($PreMute eq "On") { $PreMute = "Off"; } else { $PreMute = "On"; } }
Prints:
On
The reason that happens is that Perl subs return the last value evaluated if there is no explicit return statement. The assignments are the last thing evaluated so the result of whichever assignment happens is what is returned.
You need to read the documentation to find out what value is expected to be returned and provide an explicit return statement to ensure the right value is used.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Argument "On" isn't numeric in subroutine entry
by ornea (Initiate) on Nov 20, 2013 at 11:06 UTC |