Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Is this ancient perl or just a cargo cult?

by boftx (Deacon)
on Nov 01, 2013 at 06:12 UTC ( [id://1060712]=note: print w/replies, xml ) Need Help??


in reply to Is this ancient perl or just a cargo cult?

If you squint just a little bit it's not that hard to move back and forth between this:

sub new { my ($class) = @_; my $this = []; bless ($this, $class); $this->[PARENT] = undef; $this->[PROGRESS] = 0; return $this; }

and this:

sub new { my ($class) = @_; my $this = {}; bless ($this, $class); $this->{PARENT} = undef; $this->{PROGRESS} = 0; return $this; }

As others have already pointed out above, there are some performance perks to using a blessed array ref instead of a hash ref, but I think many of us back then felt that a hash ref was just more "natural" for an object (can the old far.... err ... C programmers like me say "struct"? I knew you could.)

The answer to the question "Can we do this?" is always an emphatic "Yes!" Just give me enough time and money.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (4)
As of 2024-03-19 06:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found