in reply to Re^2: Ulimit being reached
in thread Ulimit being reached

# THIS WORKS print (OUT $line) || die "writing 'splat' $!"; # But putting || die on another line does not. i.e: # print (OUT $line) # || die "writing 'splat' $!";
That's strange. They both work for me.

Moreover, I see no reason why they would be different, in fact Deparse tells me they produce identical code:

% cat id1.pl print (OUT $line) || die "writing 'splat' $!"; % perl -MO=Deparse id1.pl die "writing 'splat' $!" unless print OUT $line; id1.pl syntax OK % cat id2.pl print (OUT $line) || die "writing 'splat' $!"; % perl -MO=Deparse id2.pl die "writing 'splat' $!" unless print OUT $line; id2.pl syntax OK
Though you could dig further into the root cause of the difference you experienced, I suggest you just stick to the low precedence or and avoid parens with print as described earlier.

Replies are listed 'Best First'.
Re^4: Ulimit being reached
by Discipulus (Canon) on Jan 14, 2015 at 08:29 UTC
    ...and if you need or want parens after print (not in the case you put the filehandle too, but in the case your list to be printed starts with something that need parens) to avoid the error print (...) interpreted as function at .. use the following trick:
    print +(43-1);
    HtH
    L*
    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.