in reply to Help to assign a 2D-Array to another while excluding specific rows.


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

.
  • Comment on Re: Help to assign a 2D-Array to another while excluding specific rows.