#!/usr/bin/perl use strict; use warnings; my @dispatchtab = ( { moduldatei => 'test_extern.pl', aufruf => \&testsub, }, { moduldatei => 'test_extern2.pl', aufruf => \&testsub, }, ); for my $ref (@dispatchtab) { my $script = 1; eval <<"EVAL_CODE"; require "$ref->{moduldatei}" or $script = 0; EVAL_CODE if ($script) { print $ref->{aufruf}->('a'); } }