Res facta quae tamen fingi potuit (
pauamma) wrote in
dw_dev_training2010-08-31 06:34 pm
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
![[site community profile]](https://www.dreamwidth.org/img/comm_staff.png)
Nifty perl trick I learned about today
Context was someone asking why
print "Hello, world!\n" && die;doesn't output anything. Someone replied with a nifty trick to help figure this out:
perl -MO=Deparse -e 'print "Hello, world!\n" && die;'(go ahead and try it in your Dreamhack).
no subject
One thing, btw - this won't work as a built-in code beautifier because you'll find that some string literals aren't kept; they're transformed to '???'. That's because it's a constant value that Perl optimised away for whatever reason. (The perldoc for B::Deparse explains more.)
no subject
Have you thought about cross-posting this to
no subject
no subject
(What is the O for? I can find -M in man perlrun, but I can't find -O)
no subject
no subject