I could be wrong about this, very wrong considering the other answers to your post but here it is anyway. The
delete function should take care of this for you. Here is an example:
delete $array[$index];
or
delete $array[$index][$index2];
This should remove the specified element from the array. If this is incorrect, I'm sorry for the confusion and would appreciate it if someone could explain why
delete won't work for this.
Update:
According to the camel book, starting with perl version 5.6, this function will work for arrays whereas in previous versions it only worked with hashes. It also says:
Deleting from an array causes the element at the specified position to revert to a completely uninitialized state, but it doesn't close up the gap. Is this the reason that
delete shouldn't be used and if so what are the specific pitfalls in this?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.