in reply to Re: Re: Re: Syntax error using Tk
in thread Syntax error using Tk
The thing being assigned to the "-command" attribute needs to be an anonymous subroutine, a reference to a named subroutine, or else a reference to an array whose elements are: named_subroutine_ref, arg1(, arg2 ...) -- in other words, either of the following would be the right way to do what you want:-command => &numpress($i))
The way you had it written, your subroutine is actually being called when the Button is being created, and Perl/Tk is trying to use the return value of the sub as the value for "-command" -- not good.-command => sub { numpress( $i ) } # or -command => [ \&numpress, $i ]
|
|---|