Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
The stupid question is the question not asked
 
PerlMonks  

World's most boring Perl quine

by cLive ;-) (Prior)
on Oct 18, 2001 at 18:31 UTC ( [id://119760]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to World's worst Perl quine

save as "self".
open(SELF,'self'); print while(<SELF>);
cLive ;-)

Replies are listed 'Best First'.
Re: World's most boring Perl quine
by scain (Curate) on Oct 18, 2001 at 18:38 UTC
    I know writing quines isn't a serious subject (at least not to me), but is it fair practice to count on the name of the file to make the quine work? It seems like using metadata like that should be considered a cheat.

    Scott

      No, not at all. Save the following script: print $0 to a file named 'print $0'.

      BTW, that's part of why "worst" is in the title.
              - tye (Sarcasm? What sarcasm?)
Re: World's most boring Perl quine
by VSarkiss (Monsignor) on Oct 18, 2001 at 18:59 UTC

    I agree that depending on the name of the file is a cheat, so here's how another way to do it. (TIMTOWTC?) It's the same thing, but doesn't depend on the file name.

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

        Interesting.... Does that "translate" into:
        open(FILE,$0); print <FILE>;
        i.e. the one argument open is using the filename in $0 to create the filehandle 0.

        -Blake

Re: World's most boring Perl quine
by strfry() (Monk) on Oct 19, 2001 at 19:13 UTC
    i had thought that quines had to print their code out without reading themselves in?

    strfry()

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://119760]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.