use strict; use warnings; use Tk; my $main=new MainWindow; for(qw(eins zwei drei)){ $main->Button(-text=>$_,-command=>[\&p,$_])->pack; } MainLoop(); sub p { print $_[0]; }