Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: How I Learned About Quines

by GrandFather (Saint)
on Apr 16, 2010 at 08:56 UTC ( [id://835046]=note: print w/replies, xml ) Need Help??


in reply to How I Learned About Quines

My first Quine (although I wasn't aware it was called that) was written in C and I went through very much the process you describe. However some languages make it fairly trivial to write a quine. Consider:

seek DATA, 0, 0; print <DATA> __DATA__

Prints:

seek DATA, 0, 0; print <DATA> __DATA__

Adding strictures is left as an exercise (rather a trivial one to be sure) for the reader.

True laziness is hard work

Replies are listed 'Best First'.
Re^2: How I Learned About Quines
by blakew (Monk) on Apr 16, 2010 at 09:04 UTC
    I believe that's called "cheating." :)

    I started out with

    open $fh, '<', $0 or die $!; print while <$fh>;

    which even then felt wrong.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (2)
As of 2024-04-26 01:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found