Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Why Perl boolean expression sometimes treated as lvalue?

by tobyink (Abbot)
on Feb 08, 2013 at 13:28 UTC ( #1017817=note: print w/ replies, xml ) Need Help??


in reply to Why Perl boolean expression sometimes treated as lvalue?

Hmmm... interesting disparity. The following may be of interest...

use v5.10; my ($a, $b) = (0, 0); sub lv :lvalue { $_[0] } lv($a || $b) = 2; lv($a && $b) = 1; say $a; say $b;
package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name


Comment on Re: Why Perl boolean expression sometimes treated as lvalue?
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1017817]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (2)
As of 2014-09-21 11:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (168 votes), past polls