develooper Front page | perl.perl5.porters | Postings from March 2001

Re: ~~, was Re: [FWP] Shortest scalarizer?

Thread Previous
From:
Gisle Aas
Date:
March 30, 2001 11:43
Subject:
Re: ~~, was Re: [FWP] Shortest scalarizer?
Message ID:
lr7l17ujr0.fsf@caliper.ActiveState.com
Simon Cozens <simon@simon-cozens.org> writes:

> On Fri, Mar 30, 2001 at 12:19:01PM -0500, Steve Lane wrote:
> > Bernie Cosell wrote:
> > > So I tried to find something shorter and less obtrusive to
> > > 'scalarize' the arg.
> > 
> > $ perl -le 'print ~~localtime'
> > Fri Mar 30 12:18:03 2001
> 
> Neat, but I wonder whether the peephole optimizer shouldn't optimize ~~ away.
> Would we lose any semantics that way?

$ perl -le 'print 4.2'
4.2
$ perl -le 'print ~~4.2'
4                                                                               


Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About