Teaching myself Perl with Project Euler. Anywho,
print "Hei" if 1==1;
works like a charm.
Is it possible to include several statements before the if, like so
{print "4";print="2";} if 4!=2;
I’m aware that specific syntax does not work, but I think what I want to do is obvious. Possible or not?
Ps. I’m also aware I could do this with a regular
if(){}
Simply add a
dobefore it:Note that I wouldn’t recommend this kind of code in any real-life scenario. The normal
form is much more familiar, easier to read and debug, and has indentation to guide the reader regarding the flow of control.