$mw->Button ( -command => [\&print_entries, $user_x->get(), $original_y], ); #### my $command_sub; { my $x_at_time_of_sub_definition = $user_x->get(); my $y_at_time_of_sub_definition = $original_y; $command_sub = sub { print_entries( $x_at_time_of_sub_definition, $y_at_time_of_sub_definition, ); } } $mw->Button ( -command => $command_sub, ); #### -command => sub { print_entries( $user_x->get(), $user_y->get(), $original_x, $original_y, ); },