Can you give a non-empty error quine for perl? By an error quine, I mean a perl script that, when ran perl, prints exactly the same bytes to its standard error as its source code and nothing on its stdout. The printout shall be an error message coming from the perl core (or maybe a core module), not eg. something explicitly printed with a die or print statement in the source code. The program shall be ran by redirecting it to the stdin of perl, invoked without any switches.
If there is such an error quine, please give one, preferably an elegant one which doesn't seem like cheating. Please tell what version of perl the script works with.
As an example that doesn't work, take the following script:
If you run this with perl 5.16.3, you get the same error message as the source, but then get other error messages too, so this isn't an error quine.Number found where operator expected at - line 1, near "line 1" (Do you need to predeclare line?)
Update: asked for perl version.
Update: ais523 says these are called “Kimian quines”
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Is there a non-empty error quine in perl?
by kcott (Archbishop) on Mar 09, 2014 at 22:43 UTC | |
by ambrus (Abbot) on Mar 10, 2014 at 06:55 UTC | |
by MidLifeXis (Monsignor) on Mar 10, 2014 at 13:56 UTC | |
by mr_mischief (Monsignor) on Apr 03, 2014 at 20:20 UTC | |
Re: Is there a non-empty error quine in perl?
by hdb (Monsignor) on Mar 09, 2014 at 17:58 UTC | |
by Corion (Patriarch) on Mar 09, 2014 at 18:12 UTC | |
by kcott (Archbishop) on Mar 09, 2014 at 23:20 UTC | |
Re: Is there a non-empty error quine in perl?
by ambrus (Abbot) on Mar 10, 2014 at 06:50 UTC | |
Re: Is there a non-empty error quine in perl?
by ambrus (Abbot) on Apr 21, 2017 at 11:13 UTC |