Have a look at eval. You can build up your command string and execute it.
The only difference is the scoping of the variables.

----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, 28 April, 2001 11:45 AM
Subject: self-appending code


> I created a first simple program to append code to itself (script below).
Is
> there a way to get that code interpreted in the same execution? That
didn't
> happen, but when I started it a second time, the first appended text was
> interpreted, the second again not.
>
> main code
> filename: prg2.pl
>
> print"prg2 part1 \n\n";
> open (DAT,">>prg2.pl") || die"failure:\n$!";
> print DAT "\n#Appendix";
> print DAT "\nprint\"prg2 part2\";";
> close (DAT);
>
> --
> GMX - Die Kommunikationsplattform im Internet.
> http://www.gmx.net
>
>

Reply via email to