Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re (tilly) 1 (explain): Quine Whine

by tilly (Archbishop)
on Mar 06, 2001 at 20:09 UTC ( #62499=note: print w/ replies, xml ) Need Help??


in reply to Quine Whine

For those who are puzzled by quines, the following page has a good explanation of why they always exist, and exactly how to go about writing one. They are much easier to write in languages which do not require fixed chunks of text, have abundant quoting facilities, are good at string manipulation, and support eval. You will note that Perl has all of these characteristics...

The basic idea is that you have a program that consists of source and data, where the data can be expanded out into source, and also be reproduced as data. Which is why it is nice to now have fixed source that has to be there, is nice to have good ways to quote the data, is nice to be able to manipulate the data, and why it is a bonus to be able to turn data into source and then eval it.

I do urge people to write their own. It is surprisingly easy to do, and the process is very instructive.


Comment on Re (tilly) 1 (explain): Quine Whine

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://62499]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (11)
As of 2014-12-18 05:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (42 votes), past polls