Well, that's a lot more wasteful IMO, because you're grepping the entire array every time you find a login line. You're right that the resulting array never grows to the size it does in my last post, but unless you only have a handful of user who log in extremely often (like tens of thousands of times) I would say this is a bad idea.
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. -- Brian W. Kernighan