Google


ADBRITE ads links
You are here: CodeIdol.com > Perl > Intermediate Perl > References And Scoping

SAVE
Digg
Shown on del.icio.us del.icio.us
See Whos Talking About This on Technorati Technorati
I've Reddit reddit

Intermediate Perl



5.1. More Than One Reference to Data Chapter 4 explored how to take a reference to an array @skipper and place it into a new scalar variable: my @skipper = qw(blue_shirt hat jacket preserver sunscreen); my $reference_to_skipper = \@skipp...



5.2. What If That Was the Name? Typically, all references to a variable are gone before the variable itself. But what if one of the references outlives the variable name? For example, consider this code: my $ref; { my @skipper = ...



5.3. Reference Counting and Nested Data Structures The data remains alive until we destroy the last reference, even if that reference lives within a larger active data structure. Suppose an array element is itself a reference. Recal...



5.4. When Reference Counting Goes Bad Reference counting as a way to manage memory has been around for a long time. A really long time. The downside of reference counting is that it breaks when the data structure is not a directed graph ...



5.5. Creating an Anonymous Array Directly In the get_provisions_list routine earlier, we created a half dozen array names that we used only so that we could take a reference to them immediately afterward. When the subroutine exit...



5.6. Creating an Anonymous Hash Similar to creating an anonymous array, you can also create an anonymous hash. Consider the crew roster from Chapter 4: my %gilligan_info = ( name => 'Gilligan', hat => 'Whi...



5.7. Autovivification Let's look again at the provisions list. Suppose we were reading the data from a file, in this format: The Skipper blue_shirt hat jacket preserver sunscreen Professor sunscreen water...

read more: Autovivification


5.8. Autovivification and Hashes Autovivification also works for hash references . If we dereference a variable containing undef as if it were a hash reference, a reference to an empty anonymous hash is inserted, and the operation continues. ...



5.9. Exercises You can find the answers to these exercises in "Answers for Chapter 5" in the Appendix. 5.9.1. Exercise 1 [5 min] Without running it, can you see what's wrong with this piece of a program? If you can't see the problem after a mi...

read more: Exercises

SAVE
Digg
Shown on del.icio.us del.icio.us
See Whos Talking About This on Technorati Technorati
I've Reddit reddit

You are here: CodeIdol.com > Perl > Intermediate Perl > References And Scoping
   
Related tags







Popular Categories
Unix books and guides
AJAX popular information
C# language guides
Windows books and cookbooks
.......






© CodeIdol Labs, 2007