Hmmm...people don't seem to be interested in making them.
Ah well. Here is a quine that shows a standard form that you can usually get to work...
# This is a quine.
$c = "# This is a quine.
";
$t = q(-c$c = "-c";
$t = q(-t);
# Note the repeated text here. This appears both in data
# and in source. Anything you want can go here as long
# as it repeats and you do not interfere with these actions...
# Substitute the variables back into the data. If you do
# not like symbolic refs, you could use a hash instead, same
# diff. This substitution builds source out of data.
$t =~ s/-(\w+)/${$1}/g;
# Since data is now source, just print it and we are done.
print $t;
);
# Note the repeated text here. This appears both in data
# and in source. Anything you want can go here as long
# as it repeats and you do these actions...
# Substitute the variables back into the data. If you do
# not like symbolic refs, you could use a hash instead, same
# diff. This substitution builds source out of data.
$t =~ s/-(\w+)/${$1}/g;
# Since data is now source, just print it and we are done.
print $t;
Of course it is also quite possible to make jokes that are quines. In fact I already did with the rather degenerate shortest one above. And here is another joke quine:
# This is a quine two :-)
undef $/;
$_ = <DATA>;
print;
print;
__DATA__
# This is a quine two :-)
undef $/;
$_ = <DATA>;
print;
print;
__DATA__
(Come on, give it a try. Quines are really quite fun. :-)
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|