This shouldn't be confusing at all. The unshift() function in JavaScript, Perl's sister language, works the same way. When you want to unshift more than one item at a time, it grabs them as one and inserts them in front of the array in the same order as you put them. This is useful, because if we consider a real-life scenario where you want to pack some data, and the First name must come first, followed by Last Name and then the middle name, you could do something like : unshift(@PACKAGE, @NAMES); then the address, where the first element of address holds the house number, followed by street, city, state, zip code, in that order, the unshift method will not mess up the order. It will simply insert these items into the array just the way they appear in the other array: unshift(@PACKAGE, @ADDRESS); unshift(@PACKAGE, @DELIVERY_DATE_SELECTED); So, let's say you have a DATE array which contains the year first, followed by month and day. If you unshift that, the order will remain the same in the array, which is logical and that's how it should work.
-
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.
|