in reply to Self-printing program

You don't need to make a quine to have a program print its own source.

open my $fh, "<", $0; print <$fh>;

Or...

use O 'Deparse'; do something

Or without going back to the disk...

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

Replies are listed 'Best First'.
Re: Re: Self-printing program
by hardburn (Abbot) on Apr 02, 2004 at 17:22 UTC

    According to the defination on http://www.nyx.net/~gthompso/quine.htm, a quine is a program that generates a copy of its own source text as its complete output. So you do need a quine to have a program print its own source, since that is exactly the definition of a quine :)

    ----
    : () { :|:& };:

    Note: All code is untested, unless otherwise stated

      I was thinking of the other variation where people stick a copy of the program's source in the program source. I regularly write my perlmonks CGIs to include a method for printing the program's source and I've never stopped to consider that my two-line view_source() function makes the CGI a quine.