#!/usr/bin/perl use strict; use warnings; my @dispatchtab = ( { moduldatei => 'test_extern.pl', aufruf_sub => \&testsub, } # hier sind natürlich noch ganz viele ); foreach my $ref (@dispatchtab) { # nur der Code innerhalb dieser Schleife darf geändert werden, sonst nichts! { package modulscope; require $ref->{moduldatei}; $ref->{aufruf_sub}->('a'); } } sub testsub { print "Fehler, falsche sub!\n"; }