use vars '$AUTOLOAD'; sub AUTOLOAD { my ($numb) = $AUTOLOAD =~ /.*::board(\d+)_Click/; # error checking here :) set_clip($numb); }