in reply to Simulating user defined data types
There isn't an anonymous hash per se and there are no user defined data types. There are references to data holders (scalar, hash, array).
So your sample code is just a hash reference. Nothing special. What you describe as "data type called record" is a hash reference in a variable named record. You could rewrite the code like this to help clarify-
my $hash_ref = record(100,1000,10); my %record = %$hash_ref; # De-reference/copy the hash. print $record{max};
I know this is just a snippet but you are using strict and warnings in all your code, right? :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Simulating user defined data types
by JadeNB (Chaplain) on Aug 07, 2009 at 21:51 UTC | |
by Your Mother (Archbishop) on Aug 07, 2009 at 22:15 UTC |