Further to Anonymonk's point:
>perl -wMstrict -le
"use Data::Dump;
;;
my $sheet = { qw(F29 foo G30 bar) };
dd $sheet;
;;
my %sheet;
;;
print qq{'$sheet->{F29}'};
print qq{'$sheet{G30}'};
"
{ F29 => "foo", G30 => "bar" }
'foo'
Use of uninitialized value $sheet{"G30"} in concatenation (.) or strin
+g at -e line 1.
''
Do you see how the expressions $sheet->{F29} and $sheet{G30} access two completely different structures, one of which is empty?
... I can make no sense of the order in which it displays contents.
A hash has no internal "order" except for the pairing of each unique key with its value. Access to and listing of hash keys, values and key/value pairs is (apparently) random. (Update: Don't be mislead by the fact that the order in the dump displayed above matches the order of initialization of the hash reference example: this is entirely adventitious. The dump of a larger hash structure will show greater disorder — but again, a key always cleaves to its value.)
-
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.
|