I've created an array of anonymous hashes
to act as structures to hold data from some files
I'm working on parsing.
For various reasons, I need to add an element
into the middle of the array that is the same
as the one before it except for some minor
I'd been doing this with:
my $new_element = $hash_array[$index];
Of course, I've noticed that this just
makes $new_element a reference to the same
What is the best way to make $new_element
be a reference to an anonymous hash with
the same data as the anonymous hash in
, so that I may
splice it in?
(Side question: When using splice and
replacing a run of 0 length, are new elements
put at the offset position, or after?)
Thanks in advance, wise Monks.
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>
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
Want more info? How to link
or How to display code and escape characters
are good places to start.