$mw->bind( '', [sub {print "Button a has been pressed\n"}] ); $mw->bind( '', [sub {print "Button a has been released\n"}] ); #### $mw->bind( '', sub {print "Button a has been pressed\n"} ); $mw->bind( '', sub {print "Button a has been released\n"} ); #### $mw->bind( '', [ \&say_button_pressed, "a" ]); $mw->bind( '', [ \&say_button_released, "a" ]); # Unlikely to do it this way unless the following subroutines are # longer, or likely to be called from multiple places... # sub say_button_pressed { printf "Button %s has been pressed\n", $_[0]; } sub say_button_released { printf "Button %s has been released\n", $_[0]; }