[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Internal Conversions



>I've done self-modifying programs before on the Apple //e using
>Applesoft Basic.  (And yes - self-modifying programs was what I was
>talking about in my post.)  So I was wondering if anyone had ever tried
>it before.  I'm only just now discovering how wonderful EVAL really is
>and was thinking of going further than EVAL.  :-)
>

Try this...

#!perl5


$file_path = "change_code_test";

for ($count=1; $count <= 5; $count++) {
	$script = "print \"$count\n\"";
	&save_script;
	do($file_path);;
}


sub save_script {
	if (open(FILEDATA,"> $file_path")) {
		print FILEDATA $script;
		close(FILEDATA);
	} else {
		print "$file_path COULD NOT BE WRITTEN!!<br>\n";
	}
}



-------

David Seay
http://www.mastercall.com/g-s



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch