-(f()) was being deparsed as -f(), which is a filetest operator.
Extra parens are needed for negation if the child op deparses with a
single letter at the beginning.
my($op, $cx, $name, $prec, $flags) = (@_, 0);
my $kid = $op->first;
$kid = $self->deparse($kid, $prec);
- return $self->maybe_parens(($flags & POSTFIX) ? "$kid$name" : "$name$kid",
+ return $self->maybe_parens(($flags & POSTFIX)
+ ? "$kid$name"
+ # avoid confusion with filetests
+ : $name eq '-'
+ && $kid =~ /^[a-zA-Z](?!\w)/
+ ? "$name($kid)"
+ : "$name$kid",
$cx, $prec);
}
# [perl #63558] open local(*FH)
open local *FH;
pipe local *FH, local *FH;
+####
+# [perl #74740] -(f()) vs -f()
+$_ = -(f());