Not exactly on obfuscation, but I didn't know where else to put it... Warning: neither __END__ nor @data can be used anywhere in the programs in question, lest it will fail.
#!/usr/bin/perl use strict; use warnings; die("File does not exist.\n") unless -e $ARGV[0]; open(QUINE, "+<", shift); my @quine = <QUINE>; push @quine, 'my @data = <DATA>;'."\n", 'print @data, @data'."\n", "__END__\n"; push @quine, @quine; seek(QUINE, 0, 0); print QUINE @quine; close(QUINE); my @data = <DATA>; print @data, @data __END__ #!/usr/bin/perl use strict; use warnings; die("File does not exist.\n") unless -e $ARGV[0]; open(QUINE, "+<", shift); my @quine = <QUINE>; push @quine, 'my @data = <DATA>;'."\n", 'print @data, @data'."\n", "__END__\n"; push @quine, @quine; seek(QUINE, 0, 0); print QUINE @quine; close(QUINE); my @data = <DATA>; print @data, @data __END__

Replies are listed 'Best First'.
Re: Quine generator
by shmem (Chancellor) on Jul 16, 2007 at 12:08 UTC
    This one from Dave Mitchell is particularly nice: Punctuation free quine
    s zzs vvxv and s ZVZchr 122Zie and s ZVZchr 122Zie and s ZVZchr 122Zie and s SxSlcfirstSe and s YZZxZYvvxvYi and print z and s ZVZchr 122Zie and s ZVZchr 122Zie and s ZVZchr 122Zie and s SxSlcfirstSe and s YZZxZYvvxvYi and print

    --shmem

    _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                  /\_¯/(q    /
    ----------------------------  \__(m.====·.(_("always off the crowd"))."·
    ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
Re: Quine generator
by locked_user mtve (Deacon) on Jul 16, 2007 at 08:14 UTC

    classical one was:

    open 0;print<0>

      Classical ones are on the Quine page (which is apparently not maintained anymore).

      The shortest non-empty non-cheating one I know is (ends with two newlines)

      print<< x2,v10 print<< x2,v10

      Another that uses perl's various quoting operators to avoid having to escape stuff dynamically is (no newline)

      $a=q(;print"\$a=q($a)$a");print"\$a=q($a)$a"

      Update: see Short quines.

      That's CHEATING!!!!
Re: Quine generator
by Zaxo (Archbishop) on Jul 17, 2007 at 03:17 UTC

    I once twisted the rules to produce a quine generator which would work on programs that print to STDOUT. The twist was that the "own source print" happened on STDERR. That was at Quine code with quinify. It came out of an attempt to quine some of Erudil's famous obfus.

    After Compline,
    Zaxo