Hey Guys, Thank you for ALL the replies!
Great suggestions from everyone. It seems that most of you think a hash is the way to go, and I'm sure your absolutely right, but I was trying not to have to use hashes. Because I'm fairly new to perl and I was trying to keep it simple.
I do like the idea of using a new array and then using grep to find anything not equal to the given usernames, and assign the elements to the NEW array that way.
I will give your suggestions a try and see what works best for me.
Thank you all again I really appreciate the time you all took to respond.
I will report back with my results or more questions.
One question at the moment for SuicideJunkie.
You said to use splice to chop out an element. Is it possible to use that to completely remove an element and not just replace it with, say an empty element?
For example: If I have an array equal to the data given above in the OP, with elements from 0 to 7, and say elements 0 and 5 have the usernames I want to exclude, and I use splice as you suggested will my array now be (undef, 1, 2, 3, 4, undef, 6, 7)? Or will it remove them and now the array is (0, 1, 2, 3, 4, 5)?
Thanks again,
Matt
.
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.