Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: Programs that write programsby moritz (Cardinal) |
on Oct 28, 2011 at 10:20 UTC ( [id://934361]=note: print w/replies, xml ) | Need Help?? |
Sure. For example a "quine" is a program that produces its own source code as output. Running that output again as a Perl program of course yields the same output again. There are also nice multi-language quines, for example Perl code that output shell code, which then again produces the original Perl code etc. See for example http://www.nyx.net/~gthompso/quine.htm and http://johannesloetzsch.de/software/quines/. A less obscure example is a compiler: A compiler produces working code, and if it is written in the language it compiles, then it can compile itself, and the result can again compile itself etc. This is called "bootstrapping". Another example would be Acme::EyeDrops, which you can probably use on itself.
In Section
Seekers of Perl Wisdom
|
|