Depends. Most often not. Most often you are supposed to use a datastructure that supports that. If you can't use an Uzi, use something heavier. In case you want a case insensitive hash ... there are modules for that on CPAN, if you want some other definition of equality, you can do something similar to what those modules do and if you want to process all items whose keys match some more complex condition you should probably already be using a database. Even if it was just SQLite.
Of course that sometimes looping though all the keys&values is the only solution. And using anything else would either be an overkill or would not help anything, the point is that before you start looping you should be sure you have to. Before you start banging your Uzi over someone's head, you should make sure the Uzi is not loaded. To save time and to make sure you do not shoot yourself in the foot :-)
-
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.
|