Nope, take a look at the following code, especially the third stanza:
#!/usr/bin/perl -wT use strict; # hash key lookup using the actual hash (no reference) my %foo = (bar => 'data'); my $val = $foo{bar}; # fetch the scalar key (hence the '$' infron +t of foo) from the hash print "Val => $val\n"; # hash key lookup using a referent to the hash (hard reference) my %hash = (bar => 'data2'); my $foo = \%hash; my $val2 = $foo->{bar}; # can also be written '$$foo{bar}'; print "Val2 => $val2\n"; # using symbolic (soft) references use vars qw($foo $bar); $bar = 'data3'; $foo = 'bar'; my $val3; { no strict 'refs'; # 'use strict' won't allow this $val3 = $$foo; # find the data by treating the value of $foo +as a var name } print "Val3 => $val3\n"; =output Val => data Val2 => data2 Val3 => data3

-Blake


In reply to Re: Re: Re: I hope this question isn't too basic... by blakem
in thread hard/symbolic reference confusion by jupe

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.