Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^5: Perl Syntax

by tobyink (Canon)
on Oct 30, 2013 at 22:36 UTC ( [id://1060465]=note: print w/replies, xml ) Need Help??


in reply to Re^4: Perl Syntax
in thread Perl Syntax

Not an especially useful technique for managing inside-out objects. (Not without some care anyway.) Reference addresses can be recycled.

use strict; use warnings; use Scalar::Util 'refaddr'; use Data::Dumper; for my $i (0..2) { my $hash = [$i]; printf "The hash has refaddr %08X, and contents are...\n", refaddr +($hash); print Data::Dumper->Dump([$hash], ['$hash']); }

With carefully written CLONE and DESTROY methods, using the refaddr as a hash key can be made to work, but something like Hash::FieldHash saves a lot of work.

use Moops; class Cow :rw { has name => (default => 'Ermintrude') }; say Cow->new->name

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (7)
As of 2024-04-23 20:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found