When you stringify a reference, it no longer is a reference -- it's just a plain old string that happens to contain a human-readable representation of an address and a data type. So the code above is doing just what it would do if your initial hash assignment read:
%hash = ("ARRAY(0x80fbb0c)" => "STUFF");
If you turned on strict, you'd be warned that a string can't be used as an array reference.
Hash keys must be strings, not references. If you want to "dereference" something, you probably should be storing the reference itself as a hash value, so you can use it directly and not need to dereference it in the first place.
$perlmonks{seattlejohn} = 'John Clyman';
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|