#!/usr/bin/perl use strict; use warnings; use Tk; my $mw = MainWindow->new(); $mw->title("Degree converter"); my $farenheight; my $celsius; my $f_ent = $mw->Entry(-textvariable => \$farenheight); my $c_lbl = $mw->Label(-textvariable => \$celsius); my $lbl_f = $mw->Label(-text => "Enter the amount of Farenheight degrees"); my $lbl_c = $mw->Label(-text => "degrees celcius"); my $convert = $mw->Button(-command => \&convert, -text=>'Convert!'); $lbl_f->grid($f_ent); $c_lbl->grid($lbl_c); $convert->grid(-column=>0, -columnspan=>2, -row=>2, -rowspan=>1); MainLoop(); sub convert { $celsius = ($farenheight - 32) * 5/9; }