Referencing anonymous data

It is also possible to take references to literal data not stored in a variable. This data is called anonymous because it is not bound to any named variable.

To create a reference to a scalar constant, simply backslash the literal string or number.

To create a reference to an anonymous array, place the list of values in square brackets:

$shortbread = [ "flour", "butter", "eggs", "sugar" ];

This creates a reference to an array, but the array is available only through the reference $shortbread.

A reference to an anonymous hash uses braces around the list of elements:

$cast =  { host     => "Space Ghost",
           musician => "Zorak",
           director => "Moltar" };
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.219.64.172