I recently learned how to find out what Perl thinks I mean by my code. The magic of
B::Deparse.
This answered some mysteries, for example why this code will not stop on values that are seen as false:
while (<>) {
}
When writing that loop explicitly I would be testing it like this:
while (defined( my $line = <>)) {
}
It turns out that is exactly what perl is doing as well, as seen below:
perl -MO=Deparse -e 'while (<>) {}'
while (defined($_ = <ARGV>)) {
();
}
It's also interesting to see what the parser thinks about other code, such as:
perl -MO=Deparse -e ' if(1) {print "true"}'
do {
print 'true'
};
And
perl -MO=Deparse -e ' print "true" if 1'
print 'true';
And it is useful for seeing what some of the code from the Obfuscation section is actually doing.