http://qs321.pair.com?node_id=66664


in reply to Re: Icarus
in thread Icarus

have a look with some formatting...
I'm no expert but I'll have a go at explaining this one.

*$=sub{ $a=q;}die;; sub u(){$_} $= && unpack u=>u }; s[]{82G5S="!A;F]T:&5R(%!E<FP\@:&%C:V5R}six; die &$=>$/

I don't understand the *$ except that * is the typeglob prefix so *test="a" would mean $test is "a" $test[0] (from @test) is "a" and $test{a} is defined but with no value. In this case the Perl processID special variable $$ may be being overwritten with a ref(?) to the sub (someone help me out here please).

The $a line is just to put someone offtrack - the q implies a singlequoted string to follow and the sneaky bit here is that Perl allows a ; to be the delimiter hence the ;;. The offputting bit is that if you put the newline in the wrong place then you get *$=sub{$a=q;} followed by die which appears to make sense. Truth is this whole line can be removed and the output won't be affected.

sub u(){$_} is the same as sub u { return $_; }

$= is a Perl special variable a.k.a. $FORMAT_LINES_PER_PAGE (default 60) and is used here simply as a true value so the unpack will be evaluated.

the s[]{blahblahblah} is a substitution on $_ which is presumably a uuencoded string equating to "Just another Perl hacker" which the unpack reveals (six is just a clever arrangement of unnecessary modifiers to the substitution).

the last line "die &$=>$/" just dies with the returned value from the sub defined earlier although (again help please) the =>$/ (which is the special variable for the input record separator) supresses the "at blah.pl line X" which usually follows - don't know how though.

how did I do?