|Just another Perl shrine|
Re^5: Perl Hashes, keys under keys (I think)?by mmartin (Monk)
|on Sep 21, 2011 at 20:51 UTC||Need Help??|
Hey hbm, thanks for the reply.
I tried reading the data into the hash at first but it was just confusing the crap out of me (trying to use @_ or $_ and also $line) so I did the array thing just to get myself started. Once I get more comfortable with hashes, most likely by the end of this, I will probably go back and change it to what you suggested.
haha Yeah your right, I guess it is pointless to use "join" when only joining 2 elements. Good point, thanks.
I was working on this thing below that I am kinda stuck on. Maybe you could see what I am not doing right.
What I want to do is: I have this new SUB, also a new array (@colLens used this method before with a 2D-Array and it worked good). @colLens has 0..7 elements, same as the amount of fields per each record.
What it will do is, loop through the hash and if the current hash element's length is greater than the value in the same position in @colLens, then that element in @colLens will now big the bigger of the two. So the end effect will be that @colLens holds the largest length of each hash element 0..7 .
Here's what I tried:
From my output I get it seems that it is working for just the first 2 elements, not sure why the rest isn't? I'm assuming it is something with my inner-most loop...
If you can think of anything please let me know.
Thanks in Advance,