Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: $x | $y | $z = $z | ($x | $y) ?

by philiprbrenan (Monk)
on Sep 06, 2012 at 16:00 UTC ( [id://992127]=note: print w/replies, xml ) Need Help??


in reply to $x | $y | $z = $z | ($x | $y) ?

use feature ":5.14"; use warnings FATAL => qw(all); use strict; use Data::Dump qw(dump pp); sub foo() {package foo; use overload '|' => \&p; sub p {bless [@{$_[0]},@{$_[1]}]} } my $x = bless ["x"], "foo"; my $y = bless ["y"], "foo"; my $z = bless ["z"], "foo"; my $p = $x | $y | $z; pp($p)

Produces:

bless(["x", "y", "z"], "foo")

Replies are listed 'Best First'.
Re^2: $x | $y | $z = $z | ($x | $y) ?
by perl5ever (Pilgrim) on Sep 06, 2012 at 16:07 UTC
    Thanks - I see my problem now. My operation wasn't returning a blessed object.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2024-03-28 23:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found