use AnyModulesHere.pm; # Shift off first arg, rest will be used by # the "real" script my $script = shift @ARGV or die "Error: must pass filename\n"; my $code; open (FILE, "< $script") or die "Error: $!\n"; $code .= $_ while (); close (FILE); eval $code; print $@ if $@;