in reply to Reorganising a Hash for Output

Since you are already able to do this form of output:
1, a 1, b ... 3, h 3, i

just push these same items onto an array while you're doing this. Then, when you're done with this loop, print the sorted array. E.g. if the above form of output is done in a loop with a statement like this:
print "$key, $value\n";
add this line right after the print statement:
push( @secondOutput, "$value, $key" );
Then, after that loop is done, just do:
print join( "\n", sort( @secondOutput ), "" );
(the "" after the sort is so that join() will add a linefeed after the last array element).

Replies are listed 'Best First'.
Re: Re: Reorganising a Hash for Output
by arunhorne (Pilgrim) on May 07, 2002 at 13:43 UTC
    Thanks graff... I like your thinking and it worked great. Cheers :D