[tpm] Stupid question time!

Adam Prime adam.prime at utoronto.ca
Fri Jan 29 17:26:20 PST 2010


5.10 has defined or which isn't quite the same thing but you could 
achieve something like it with

my $bar = $foo // undef;

Adam

Shaun Fryer wrote:
> I often find myself doing things like this...
> 
> my $bar = $foo if $foo;
> 
> ...and I wish there were an assignment operator conditional on 
> right-hand truthiness. maybe...
> 
> my $bar ?= $foo; # as opposed to $bar ||= $foo;
> 
> Thoughts? Have I overlooked an existing operator? Is this just a bad idea?
> --
> Shaun Fryer
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> toronto-pm mailing list
> toronto-pm at pm.org
> http://mail.pm.org/mailman/listinfo/toronto-pm



More information about the toronto-pm mailing list