It's not just approximately shown; the keys documentation explicitly says that (so long as it's not modified) they will return the same order for the same hash (emphasis mine):
Hash entries are returned in an apparently random order. The
actual random order is specific to a given hash; the exact same
series of operations on two hashes may result in a different order
for each hash. Any insertion into the hash may change the order,
as will any deletion, with the exception that the most recent key
returned by "each" or "keys" may be deleted without changing the
order. So long as a given hash is unmodified you may rely on
"keys", "values" and "each" to repeatedly return the same order as
each other.
The cake is a lie.
The cake is a lie.
The cake is a lie.
-
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.
|