Example Reference Script Clippings Some Variations on Notation Using a Reference with Hash of Arrays See also: Resource on References Back to my MacPerl index page
Overview I'm including below a number of script clippings i used to test various examples from readings on references. Several are based on an exercise in Recipe 4.5 in the Perl Cookbook. you can also view the entire script described in sections below.
Some Variations on Notation Which returns: One would be dog. Two would be dogs. Here's an example of two variations of array notation: Both return: Return to top
Using a Reference with Hash of Arrays Here's a script based on the Perl Cookbook example. This should return memory addresses, i.e., the refs themselves, and the type of data it points to (ARRAY), because we are actually working with a hash of references to anonymous arrays: Which returns: Key: canines Value: ARRAY(0x4ec3f64) Key: felines Value: ARRAY(0x4ec3f34) Note: You can create a reference to an array by simply using the following syntax: Resources on Perl References page for more information.)