#!/usr/bin/perl use warnings; use strict; use Tk; my $mw = new MainWindow; $mw->geometry("300x300"); my %button; my $ans = 'foobar'; my $num_screen = $mw->Entry(-width => 40, -state => 'disabled', -textvariable => "$ans") ->pack(-pady => 30, -anchor => 'ne', -side => 'top'); my @buttons = ( '9','8','7','6','5','4','3','2','1','0'); for (my $i = 9; $i >= 0; $i--) { $button{$i} = $mw->Button( -text => "$buttons[$i]", -width => '3', -height => '3', #-command => &numpress($i)) )->pack(-anchor => 'nw', -side => 'top'); } MainLoop;