#!/usr/bin/perl use strict; use warnings; my @dispatchtab = ( { moduldatei => 'test_extern.pl', aufruf => \&testsub, string => defined, }, { moduldatei => 'test_extern2.pl', aufruf => \&testsub, }, # hier sind natürlich noch ganz viele ); for my $ref ( @dispatchtab ) { require $ref->{moduldatei}; my %back; if (defined $ref->{string}) { $back{text} = $ref->{aufruf}->($ref->{moduldatei}); } else { $ref->{aufruf}->($ref->{moduldatei},\%back); } print "$back{text}\n"; undef &testsub; # hier das &testsub muss aus einer Variable kommen, kann so nicht bleiben }