Narcissist: Difference between revisions

m
→‎{{header|Perl 6}}: Use nested quoting delimiters.
m (→‎{{header|REXX}}: removed superfluous blank lines. -- ~~~~)
m (→‎{{header|Perl 6}}: Use nested quoting delimiters.)
Line 137:
=={{header|Perl 6}}==
 
For the narcissist to work you must be very careful with whitespace. The presented version works if it is stored as a file of exactly one line terminated by a (Unix) newline character.
 
Note: Thehow the code cantakes beadvantage simplified as soon asof Perl 6's implementationsability supportto nestednest quoting delimiters properly (i.e. q{ ...{...}...}).
 
<lang perl6>my $self=q|{say slurp() eq ('my $self=q{'~124.chr~$self~124.chr~'}; eval($self);'~10.chr)| ?? 'Beautiful!' !! 'Not my type.'}; eval($self);
</lang>
 
{{out}}
<pre>$ rakudo narcissist.pl <narcissist.pl
Beautiful!
True
$ rakudo narcissist.pl <any-other-input.txtpl
Not my type.
False
</pre>
 
57

edits