line 7 also reads line 5 --> Just
line 12 also skips the first line of ELT ('my') --> Another
line 14 triggers the Comment handler to skip the 'or' from ELT
line 14 same with the second 'my' from ELT
line 16 reads a line from ELT, that's the important bit --> Xml
line 18 read a line from ELT and doesn't do much with it (skip it) --> Hacker
line 21 just use the fact that < > are valid delimiters
line 21 same trick
line 23 back to depth 0 in the document, the final \n is output --> \n
####
1 #!/bin/perl -w
2 use strict;
3 seek DATA, $[,$[; # really seek 0,0, you have to use special variables ;--)
4 sub another{ foreach( $[..(($^W<<1)+$^W)) { }} # skip 3 lines ($^W is 1 so $^W<<1 is 2 )
5 my $just= another or my $xml=hacker() and ; # $xml is set to the text on this line FH set to line 7
6 sub hacker { $_= # return line 5
7 } # beginning of the XML document
8 sub smoke { pipe 0, 1} # used only because it returns true
9 sub mirror { return join( " \n", split( /[^a-x]+/, $xml))} # return ("my \njust \nanother \nor \nmy \nxml \nhacker \n")
10 sub ON { "perl -e'print q{". (smoke and mirror) . "}' |" } # prepare opening a pipe that will just print the text above
11 open( ELT, ON); # ON will get the line generated by mirror
12 ; # an XML element, also skip the first my on line 5
13 use XML::Parser; # you need this in an XML obfus!
14 $xml=~ s; # useless in Perl, but 2 XML comments (to skip 'or' and 'my')
15 my $parser= XML::Parser->new( Handlers => # did I mention this was an XML obfus?
16 { Start => sub { while( ) { chomp; print ucfirst; last; } }, # start handler: read from ELT, print the ucfirst'ed word, return
17 End => sub { print "\n" if( $_[0]->depth == 0); }, # output the final \n
18 Comment => sub { =~ m;} # used to skip unwanted token from line 5
19 });
20 $parser->parse( \*DATA); # XML has to be parsed using a parser, no silly regexp here!
21 $just=q. qq; # close elements, usinq angle brackets as q delimitors
22 __DATA__ # yes we need it
23 # the closing DATA tag must be the last token in the file