I'm impressed by how well parts of your code foil
Perl::Tidy. The
"@{[...]}" and
s{}{...}e notation and the
__END__ at the end of a line all cause
Perl::Tidy not to respace those sections of code at all. The following modification is
Perl::Tidy-friendlier:
#!/usr/bin/perl
END{$_=(join$",@{[map{$%=$_;$_=&{$_{$_}};$%%2&&s%.%\u$&%;$_}($|..${$/=
+\
($^A+$|+$?)})]}).",";print}($,,$,,+$*,$,,$,)=($|..$=/(+++$^A+$^A)*
+++$^A*++$^A);@_{++$|..2**(++$-+$-)}=(sub{(join$',map{+chr($|+$,+
ord($_))}reverse((split$`,&{$_{$=/($,*$,+$,)}})[$...$|]))."${\'s'
}".substr(&{$_{2}},$^A,$|)},sub{"anoth".substr(&{$_{$^A}},+$-,$-+
$|)},sub{$a="\104\101\124\101";!seek$a,$=/($*+$,)+$|,$;or~~<$a>},
sub{local$";join$",@{[(split//,(chr($^A-$|+ord(substr(&{$_{$^A-$|}},+$
+?
..++$?)))).&{$_{$,/($^A-$|)}}.chr(2*$=-$^A*$,-$|))[$,+$|,$|,$--$|
,+-+$|,-$|x$?,+$=/(0+$,*+$*+-+-$*),$,+-+-~~$*+-+-$|]]}});
__END__
Here is a tidied version with comments:
#!/usr/bin/perl
END {
$_ = (
join $",
@{
[
map { $% = $_; $_ = &{ $_{$_} }; $% % 2 && s%.%\u$&%;
+$_ }
# ucfirst odd words (1 -> "Just", 3 -> "Perl")
( $| .. ${ $/ = \( $^A + $| + $? ) } ) # 3+1+0 == 4;
+ $/ == \4
]
}
)
. ","; # canonical
print;
}
# $, == $* == $^A == undef; $| == $- == 0; $= == 60
( $,, $,, +$*, $,, $, ) = ( $| .. $= / ( +++$^A + $^A ) * +++$^A * ++$
+^A );
# $, == 4; $* == 2; $^A == 3; $| == $- == 0; $= == 60
@_{ ++$| .. 2**( ++$- + $- ) } = ( # hash slice @_{ 1 .. 4 } = (
# $, == 4; $* == 2; $^A == 3; $| == $- == 1; $= == 60
sub {
(
join $', # $' == last successful pattern match == undef
# in original code $' == "" due to s{}{...}
map { +chr( $| + $, + ord($_) ) } reverse( # $| + $, == 5
( split $`, &{ $_{ $= / ( $, * $, + $, ) } } )[ $. ..
+$| ]
# $` == ""; 60/(4*4+4) == 3; $. == 0; $| == 1; "ep" -> "ju"
)
)
. "${\'s'
}" . substr( &{ $_{2} }, $^A, $| ); # substr("another",3,1) == "t"
},
sub {
"anoth" . substr( &{ $_{$^A} }, +$-, $- + $| );
# substr("perl",1,2) == "er"
},
sub {
$a = "\104\101\124\101"; # "DATA"
!seek $a, $= / ( $* + $, ) + $|, $;
# 60/(2+4)+1 == 11; $; eq chr 28 == 0
# ! / u s r / b i n / p e r l \n
#1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6
or ~~<$a>;
# "perl" since $/ == \4;
},
sub {
local $";
join $",
@{
[
(
split //,
(
chr(
$^A - $| + # $^A - $| == 2
ord( substr( &{ $_{ $^A - $| } }, +$? ..
+ ++$? ) )
# $? == 1; substr("another",0,1) == "a" -> "c"
)
)
. &{ $_{ $, / ( $^A - $| ) } } # 4/(3-1) == 2 ->
+ "another"
# &{$_{2}} calls &{$_{3}} which does a seek() and resets $? to 0
. chr( 2 * $= - $^A * $, - $| ) # 2*60-3*4-1 ==
+107 -> "k"
)[
# canotherk
# 012345678
$, + $|, $|, $- - $|, +-+$|, -$| x $?,
# 4 + 1 == 5 -> "h"; 1 -> "a"; 1 - 1 == 0 -> "c"; -1 -> "k", -1 x 0 ==
+ ()
+$= / ( 0 + $, * +$* + -+-$* ),
# 60/(0+4*2+2) == 6 -> "e"; 4+2+1 == 7 -> "r"
$, + -+-~~$* + -+-$|
]
]
};
}
);
__END__