For the baffled, let me explain. The -p switch physically adds code around your code.
# perl -pe CODE
while (<>) {
CODE;
} continue {
print or die qq(-p destination: $!\n);
}
with the exception that there's minimal whitespace. So if CODE is print q, you end up printing print or die qq(-p destination: $!\n), the length of which is 47 characters.
_____________________________________________________
Jeff[japhy]Pinyan:
Perl,
regex,
and perl
hacker.
s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??; | [reply] |
So, the ';' is being used as the delimiter for q...
q;}continue ... $!\n);
Very strange indeed, I thought the closing bracket was the delimiter and thus was quite confused. So, not only does it physically
wrap your code in a while loop, it adds an unnecessary semicolon before the end of the block. Or at least thats what it looks like to me....
Oh, in last Friday's golf, chipmunk had a one-liner entry that (ab)used this "physical" wrapping feature of -p (well -n really) for those that want another data point to play with.
-Blake
| [reply] [d/l] |
Well, you've got me there, without Deparse I'd have no idea where to start on this one....
% echo blakem | perl -MO=Deparse -peprint -elength -eq
LINE: while (defined($_ = <ARGV>)) {
print length '}continue{print or die qq(-p destination: $!\\n)';
}
-e syntax OK
That q is gobbling up a big chunk of the control structure. weird stuff indeed...
-Blake
| [reply] [d/l] |
japhy,
I understand blakem's and your explainations, but what I
am wondering if the real obfuscation is in the title of the
node. Could you elaborate on what this has to do with
Star Trek trivia?
Thanks,
Scott
Update: I guess I should do the research myself; thanks google. | [reply] |
Hi
This is have to do with the "conspiracy" with the number 47 showing up in star trek episodes all the time? I also would like to be filled in | [reply] |
| [reply] |
To be more specific, 47 is (or was originally) the Pomona College Math department magic number. The derivation, heretofore known only to the initiated, is partially revealed here. Math professors in good humor would, on occassion, award partial credit for an answer of "47" on math quizes. I once availed myself of this on one of Professor Bentley's exams.
| [reply] |