#!/usr/bin/perl use strict; use warnings; my %functions = (1 => \&print_hello); while(1){ print_menu(); my $choice = ; chomp $choice; if(exists $functions{$choice}){ $functions{$choice}->(); } else{ print "ungueltige Eingabe\n"; exit; } } sub print_hello{ print "Hello\n"; } sub print_menu{ print q~ +------------------------+ | Bitte waehlen Sie: | | 1: print hello | | sonst Ende | +------------------------+~; }