#!/usr/bin/perl use strict; use warnings; my @dispatchtab = ( { moduldatei => 'test_extern.pl', aufruf_sub => \&testsub, }, { moduldatei => 'test_extern2.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! { require $ref->{moduldatei}; package modulscope; $ref->{aufruf_sub}->('a'); } }