Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^5: C-Style Struct?

by xiaoyafeng (Chaplain)
on Aug 10, 2012 at 01:11 UTC ( #986638=note: print w/replies, xml ) Need Help??


in reply to Re^4: C-Style Struct?
in thread C-Style Struct?

But now I can see no advantage to using your example over just using a hash ;)

No, My way is using a perl object to create a struct, every struct created by this has the same elements and spawned by the same creator.
my %hash_1 = (number => 123, name => aa, stuff => \@xx); my %hash_2 = (number => 124, name => bb, stuff => \@yy); my %hash_3 = (number => 125, name => cc, stuff => \@zz); #if you chang +e struct, you have to change every instance. ..... ..... ..... my $aa = C_struct->new(123,'aa', [1,2,3]); my $bb = C_struct->new(234,'bb', [2,3,4]); #every instance is spawned +by the same object.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://986638]
help
Chatterbox?
[1nickt]: Corion I feel that way a lot when I look at the news...
[1nickt]: Brethren, I just noticed in the CPAN ticker Retry, which led me to Attempt, by Mark Fowler. Does anyone have experience with either of these utilities?
[Corion]: No. Back when I toyed with the idea, I found that writing the loop explicitly was usually less code than passing the configuration+ callback to the retrier...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (13)
As of 2017-05-24 12:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?