Christian Kruse: Wozu Referenzen ?

Beitrag lesen

Hoi,

Ich wollt mal wissen, wozu man eigentlich Referenzen benötigt? Ja um
irgendwie die Speicherposition, oder so, zu ermitteln,

Nicht wirklich. perldoc perlref

aber bei welchen Anwendungsbereich soll das gut sein, zu wissen, oder wo
werden Referenzen eingesetzt ?

perldoc perlreftut:

DESCRIPTION
       One of the most important new features in Perl 5 was the
       capability to manage complicated data structures like
       multidimensional arrays and nested hashes.  To enable
       these, Perl 5 introduced a feature called `references',
       and using references is the key to managing complicated,
       structured data in Perl.  Unfortunately, there's a lot of
       funny syntax to learn, and the main manual page can be
       hard to follow.  The manual is quite complete, and
       sometimes people find that a problem, because it can be
       hard to tell what is important and what isn't.

[...]

Who Needs Complicated Data Structures?
       One problem that came up all the time in Perl 4 was how to
       represent a hash whose values were lists.  Perl 4 had
       hashes, of course, but the values had to be scalars; they
       couldn't be lists.

Gruesse,
 CK