in reply to Open a .pl file form a .pl file

Read through perldoc -f eval. The following shows a quick demo.

#!/usr/bin/perl use strict; use warnings; open FILE, "test1.pl" or die "Cannot read test1.pl: $!\n"; my $file = join '', <FILE>; close FILE; eval $file; # Check for errors. die $@ if $@;

Replies are listed 'Best First'.
Re: Re: Open a .pl file form a .pl file
by tlhf (Scribe) on Sep 19, 2002 at 00:13 UTC
    Wouldn't it be much simpler to do something along the lines of;

    do "test.pl";

    tlhf