in reply to (jeffa) Re: array pushing
in thread array pushing

Thanks for your help everyone, I greatly appreciate it. It turns out that since I was using a hash to begin with I didn't have to turn it into an array in order to sort it the way I needed. Not sure why I had the crazy idea it had to be an array but the problem was quickly solved when jeffa pointed out I could just sort the hash I was working with.

When the time comes I'll be prepared to use arrays like this, thanks everyone.

"Age is nothing more than an inaccurate number bestowed upon us at birth as just another means for others to judge and classify us"

sulfericacid

Replies are listed 'Best First'.
(jeffa) 3Re: array pushing
by jeffa (Bishop) on Apr 27, 2003 at 17:31 UTC
    Ahh, but you are using an array to sort with! Consider these:
    print $key for $key sort keys %hash; print $val for $val sort values %hash;
    Sure, the far right side is a hash, but what are keys and values? They are built-in functions (just like sort) that return lists. The trick is what you do with those lists.

    What is the difference between a list and array? Well, you did take The Mad Hatter's advice and read japhy's article, didn't you? Just remember, a lot of folks (including myself) have a hard time understanding that material. Sometimes the concept itself is just too darned difficult for anyone to teach it in an easy to digest manner ... repeated reading / experimentation is how i learn that stuff. Sometimes that revelation doesn't hit you until years have passed. Keep on truckin' ... or change your interest and do something else. ;)

    jeffa

    rinse ... repeat ...