#!/usr/bin/perl use strict; use warnings; use Tk; my $text = ''; my $text2 = ''; my $rbv = ''; my $mw = tkinit; $mw->Entry( -textvariable => \$text )->pack; # fuege das Entry-Feld hinzu my $cb1 = $mw->Radiobutton( -text => 'Radiobutton1', -value => 1, -variable => \$rbv )->pack; my $cb2 = $mw->Radiobutton( -text => 'Radiobutton2', -value => 2, -variable => \$rbv )->pack; my $btn = $mw->Button( -text => 'Ok', -command => \&button_clicked )->pack; my $entry = $mw->Entry( -textvariable => \$text2 )->pack; MainLoop; sub button_clicked{ if( $rbv == 1 ){ fill_text1(); } elsif( $rbv == 2 ){ fill_text2(); } else{ $text2 = 'Fehler!'; } } sub fill_text1{ $text2 = 'Sie haben eingegeben: ' . $text; } sub fill_text2{ $text2 = 'Ihr Text: ' . $text; }