Another way...
print "stuff" and return if $foo;
(Works because if is a statement modifier and and creates an expression, thus if has a lower binding (statements can contain expressions but not the other-way-round); more or less.)
Update: Erp. Changed comma operator to and since the comma didn't work. :-/ Same principal, but order of execution was not guaranteed with the comma, so it was returning before printing.... grr.
Update2: Of course, neither mine, nor tachyon's methods will return if the print fails (in can, but almost never does in practice). *shrug*
Update3: Argh! :-) The real reason why the comma operator didn't work was that I was evaluating the return value of return as the last argument to the print statement. The following does work (and is what I intended all along ;-p )...
print("stuff"), return if $foo;
bbfu
Seasons don't fear The Reaper.
Nor do the wind, the sun, and the rain.
We can be like they are.
In reply to (bbfu) (another way) Re: print and return...
by bbfu
in thread print and return...
by suaveant
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |