There's more than one way to do things PerlMonks

### Comment on

 Need Help??

Set your code-viewing glasses to a full 80 columns or more. (Find it in your user settings, if you see red plus marks.) This code tested on 5.8.0 on a variety of Linux architectures.

CAUTION! This program can use a lot of computing resources for very long periods of time. It may take an hour or more just to find the first of thousands of possible solutions.

\$ perl quine
For more output, try adding the --verbose command line option. This will cause the program to print incomplete results every few seconds, to help you see what it is doing. These partial results are usually full quines, but this isn't guaranteed. Full solutions are always quines.
```#!/usr/bin/perl
\$_=\$w=q#
\$w=~s=\s|\n==sg ;++\$L{'                 FfFffFF fFf'};(\$b,\$B,\$b b,\$BB)
+=(10,6,8,
6);\$q=int(\$b/2) ;(\$*,\$"                 ,\$/,\$:, \$;)=split//,"\0 40:\n\
+043_";\$D=
\$"x(\$b+2);\$D=\$D .(\$".(\$                 *x\$b).\$ ")x\$B.\$D;\$Z=sub {rever
+se@_};++\$
L{'IIIIi'};\$T=s ub{my(\$                 x,\$P,\$T ,\$O,\$F)=(0,\$b*\$ q+\$q,@
+_);\$_=\$"x
(\$b+\$b*\$b+\$b);m y@T=(-2                 -\$b,1,2 +\$b,-1);@T=&\$Z( @{T})i
+f\$F;while
(\$T){\$X=substr( \$T,0,1,                 '');\$x= lc\${X}i         f!\$x;s
+u
bstr(\$_,\$P,1,\$x );(\${X}ne\$x)?(\$         P+=\$T[\$ O]):(\$O =(\$O+1)%(@T))}
+s =\A\$"+=
=s;s=\$"+\z==s;\$ _};++\$L{'LlLLLl         '};\$W=s ub{\$_=s hift;eval(qq%y
+/ \$"f-z/.
\$*/%);s-(\.{4,} )-'.{'.length(\$         1).'}'- ge;qr/\$ _/};++\$L{'NNnn
+n NnNn'};
++\$L{'PPpPpPp'} ;\$r=sub{local(\$         _,\$m)=@ _;s/\$"/ /g;s/(.)/\$1x\$b
+b /ge;\$x=
\$bb*\$b;s|(.{\$x} )|\$1x\$BB|eg;s~(         ?<=(.)) (.)~(\$1 eq\$2)?\$2:\$*~eg
+; \$x--;s~
(?<=(.)         .{\$x})(                 .)~(\$2n e\$1)?\$* :\$2~ge;
+  s|.(.{\$
x})|\1\$ /|g;s!.*?\$/!!s;                 \$x=\$w.\$ ;.\$w;s: \S:subs tr(\$x,
+0,1,''):g
e;print "\$:!\$^X\$/",q@\$_                 =\$w=q@, \$:,\$/,\$ _,"\$:", q@=>s=
+\s|\n|@,\$
;,\$;,q@ .*==sg=>eval@,\$                 /,"\$;\$; DATA\$;\$ ;\$*\$m\$/ ";};++
+\$L{'TTtTt
tTTt'}; \$L=sub{my(\$Z,\$O                 ,\$F);fo r\$x(key s%L){\$L {\$x}={
+};for\$O(0
..3){fo r\$F(0,1){\$Z=&\$T                 (\$x,\$O, \$F);\$L{ \$x}{\$Z} =&\$W(\$
+Z);}}}};+
+\$L{'Uu UUuUu'}         ;(\$L5,
+\$
L4,\$L3,\$LL)=(\$b -4,\$b-3         ,\$b-2,\$ b-1);(\$ S,\$s)=(         "S-S\$L
+L :","S--
S\$LL:");\$h=["S\$ b:S-S\$b         :S","S\$ b:\${S}S -S\$b:S"         ,"SS\$L
+L :\${s}SS
","S\$b:\${S}\${S} S-S\$b:S         ","SSS\$ L4:S--- S\$L4:SS         ","S\$b
+: \${S}\${s
}SS","S\$b:S-S\$L 3:\${s}S         S","SS\$ LL:S--S \$L3:S-S         \$b:S",
+" SS\$LL:\$
{s}S-S\$b:S","S\$ b:\$S\$S\$         {S}S-S\$ b:S","S SS\$L5:S         ----S\$
+L 5:SS","
SS\$LL:S         --S\$L3:         \${s}SS" ,"S\$b:\$                 S\$S\$S\$
+S \${S}S-S
\$b:S"]; for(@\$h){s=S=\134S=g;s= \-=\$*=g ;s=(\d+                 ):=.{\$
+1 }=g;\$_=
qr/\$_/} ++\$L{'VVvVVv'};\$H=sub{m y\$X=shi ft;for\$                 x(@\$h)
+{ return'
'if\$X=~ /\$x/}1;};++\$L{'WwWwwwWw Ww'};\$V =sub{my                 (\$I,\$D
+, \$q,\$Q)=
(0,@_); for\$I(0..-1+length(\$Q)) {\$_=sub str(\$Q,                 \$I,1);
+i f(\$"eq\$
_){next }substr(\$D,\$I+\$q,1,\$_); }&\$H(\$D )&&&\$A(                 \$D);};
++ +\$L{'XX
xxXxXxx         XXx'};\$         S=\$c=0;
+  ++\$L{'Y
yYyyYYYy'};\$A=s ub{++\$c ;my(\$D)=@_;!@A&&(&\$r(\$D         ,"SOLUTION".++
+\$S),retur
n);@ARGV&&(@A<3 )&&&\$r( \$D,"\$c\$*moves");my(\$aa,         \$a)=('',pop@A)
+;for\$aa(s
ort(keys%{\$L{\$a }})){wh ile(\$D=~m/(?=\$L{\$a}{\$aa         })/g){&\$V(\$D,p
+os(\$D),\$a
a);++pos(\$D);}} push@A, \$a;};++\$L{'ZzZZzzzZz'};         &\$L;@A=&\$Z(sor
+t(keys%L)
);&\$A(\$D);__@@* %&(*%(* @&%(*&@^_\$w=~s=\s|\n==s         g;++\$L{'FfFffF
+FfFf'};(\$
#=>s=\s|\n|__.*==sg=>eval
__DATA__                                            [ e d @ h a l l e
+y . c c ]

Watch this space. I'll insert a link to my POD documentation which gives the blow-by-blow explanation in a few days. For now, the name and the visuals are all I'll give away.

In reply to Pentominos Solving Quine by halley

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

• Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
• Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
• Read Where should I post X? if you're not absolutely sure you're posting in the right place.
• Posts may use any of the Perl Monks Approved HTML tags:
a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
• You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
 For: Use: & & < < > > [ [ ] ]
• Link using PerlMonks shortcuts! What shortcuts can I use for linking?

Create A New User
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (7)
As of 2018-04-26 19:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
My travels bear the most uncanny semblance to ...

Results (97 votes). Check out past polls.

Notices?