This question has been asked before. The original work can be found here. They got it down to
die`man $^Xfaq1`=~/"(j.*)"/
as opposed to
die"Just Another Perl Hacker\n"
It's not exactly a general solution and the formatting is a little off, but I'm very impressed. | [reply] [d/l] [select] |
You always miss an obvious character:
die'Just another Perl hacker
'
| [reply] [d/l] |
Hmm... not very portable, but:
perl -042e'print((`$^Xdoc -qj`)[1])'
MeowChow
s aamecha.s a..a\u$&owag.print | [reply] [d/l] |
| [reply] [d/l] [select] |
The following code will print a JAPH, occasionally:
print chr rand 127 for 1..25
MeowChow
s aamecha.s a..a\u$&owag.print | [reply] [d/l] |
The question is, is there anything more economical than:
print"Just Another Perl Hacker"
Sure. Same message, different words:
die"JAPH\n"
That's 11 keystrokes of code accompanied by over 1000 characters of hidden description
(there's sure room for some golf with the description).
| [reply] [d/l] [select] |
Going with the theory that you never really know where the lines are until you step over them, I submit
die"$0\n"
Of course, the file was named "Just Another Perl Hacker" ...
| [reply] [d/l] |
I submit that the following is shorter:
perl -pee
Then start pressing the following keys: 'J', 'u', 's', 't' SPACE, 'A', 'n', 'o', 't', 'h', 'e', 'r', SPACE, 'P', 'e', 'r', 'l', SPACE, 'H', 'a', 'c', 'k', 'e', 'r', ENTER. Japhage magically occurs...
MeowChow
s aamecha.s a..a\u$&owag.print | [reply] [d/l] |
If you are going to go through this trouble, name the file
"Just another Perl hacker,\n" and then reduce it to:
die$0
| [reply] [d/l] |
Not quite. You need the "\n" at the end of the die() argument to keep it from spitting out the filename (again) and line number.
| [reply] [d/l] |
Not shorter.
perl -lpe '}$_="Just Another Perl Hacker";{' .
John.
--
| [reply] [d/l] |