in reply to Examples of the importance of references?
Of course for small arrays, it really dosn't matter.my $aref = get_values(); sub get_values{ my @array = (1..5000000); return \@array; }
Another place you will see references used often is in objects. You don't want to pass around copies of objects, so you pass their memory location (reference). Inside the object, the object refers to itelf as $self, because it dosn't care where it is located.
|
|---|