&defineOrder($widget1, $widget2, $widget3) # sub defineOrder { for (my $i = 0; defined($_[$i+1]); $i++) { # REMOVE the anonymous sub call and replace with # reference to widget which has its own scope ${$_[$i]}->bind('', \${$_[$i+1]}->focus ); } ${$_[0]}->focus; }