foreach my $button ( @buttons ) { ......... ........ # Add a button widget $frame->Button( -anchor => 'nw', -text => "change " . $button, -command => [\&print_button_label, $button], )->pack( -side => 'left', -anchor => 'w', -padx => 2 ); } ############################################### sub print_button_label{ my $button = shift; print "button\n"; } #### -command => sub { print_button_label( $button ) },