Jonathan Lang skribis 2006-10-19 18:27 (-0700): > Let's say that I want > > $expression?; > > to mean the same thing as the statement > > $_ = $expression; > > That is, any statement that ends with a '?;' instead of a ';' > evaluates in scalar context instead of void context and stores the > result as the topic '$_'. (I was going to suggest '?' intead of '?;', > but a quick review of the specs pointed out that this would be > ambiguous wrt the ? prefix operator.)
Prefix and postfix live in different places, so you can just use a normal postfix operator: sub postfix:<?> ($lhs) { $CALLER::_ = $lhs; } 42?; say($_); # prints 42! # This code is not futuristic. It already works with Pugs. But you wanted a statement thingy. That would require that you modify the Perl 6 grammar. Yes, you can do that with Perl 6. -- korajn salutojn, juerd waalboer: perl hacker <[EMAIL PROTECTED]> <http://juerd.nl/sig> convolution: ict solutions and consultancy <[EMAIL PROTECTED]> Ik vertrouw stemcomputers niet. Zie <http://www.wijvertrouwenstemcomputersniet.nl/>.