176

References & Structures
More Complex Records

  • Using all of the concepts presented in this chapter one can construct arbitrarily complex record structures
      $myScalar = "Hello World";
      @myList = ( "Hello", "World" );
      %myHash = ( 'a', "Ape", 'b', "Bat" );
      sub mySub { print "Hello World\n"; }
      $myListRef = [ 1, 2, [ 'a', 'b', 'c' ]];
      
      $rec = {
      	TEXT_CPY => $myScalar,
      	LIST_CPY => [ @myList ],
      	HASH_CPY => { %myHash },
      	SUBR     => \&mySub,
      	TEXT_REF => \$myScalar,
      	LIST_REF => \@myList,
      	HASH_REF => \%myHash,
      	LREF_REF => $myListRef,
      };