On Sat, Oct 26, 2002 at 01:59:46AM +0200, Paul Johnson wrote:
> On Fri, Oct 25, 2002 at 06:28:28PM -0400, Miko O'Sullivan wrote:
> > From: "Larry Wall" <[EMAIL PROTECTED]>
> > > :      ?   - force to bool context
> > > :      !   - force to bool context, negate
> > > :      +   - force to numeric context
> > > :      -   - force to numeric context, negate
> > > :      ~   - force to string context
> > >
> > > We're obviously missing the "force to string context, negate" operator.
> > :-)
> > 
> > Mr. Wall, may I be excused?  My brain is full.  Oh, I have to stick it out
> > with everyone else? OK, um....
> > 
> > Just so I understand... why do we need "force to blah context" operators at
> > all?  Are we planning on doing a lot of context forcing?  Isn't "a lot of

> The negate operators we have already:
> 
> perl -e '$x = "0"; print !$x'
> perl -e '$x = "10.000"; print -$x'

Here is something that maybe you'd forgotten:

$ perl -lwe '$x = "Good"; print -$x'
-Good
$ perl -lwe '$x = "-Good"; print -$x'
+Good
$ perl -lwe '$x = -"Good"; print -$x'
+Good
$ perl -lwe '$x = "+Good"; print -$x'
-Good

Unary plus is actually irrelevant:

$ perl -lwe '$x = +"Good"; print -$x'
-Good

Nicholas Clark
-- 
Brainfuck better than perl?     http://www.perl.org/advocacy/spoofathon/

Reply via email to