That's a great idea. What if the hash content is parsed by the CGI.pm and entered into the params hash using:
use CGI qw(:standard :cgi-lib); my %params = Vars; What a pain... haha =) Could I go: use CGI qw(:standard :cgi-lib); my %params = Vars; my @keys = Vars; at all? I don't know enough about the CGI.pm's internal workings I guess. -Shannon > From: "Bradford Ritchie" <[EMAIL PROTECTED]> > Date: Wed, 24 Oct 2001 20:03:34 -0400 > To: "Shannon Murdoch" <[EMAIL PROTECTED]> > Subject: Re: Printing Hash Keys > > > The order isn't preserved within the hash so I believe you'll either have to > push the keys onto an array as they're added to the hash, or use some other > structure (like another hash) to remember the order of entry. > > -- Brad > >> Thanks RaFaL, >> print join "\t", sort keys %params; >> works excellently. >> >> What if I don't want to sort them (display the keys in the same order they >> were entered)? >> >> Let's say the hash was: >> >> %params = qw( >> dirt 4 >> sand 5 >> land 2 >> air 5 >> wind 9 >> breath 1 >> ); >> >> >> A sorted hash would come out as: >> >> air breath dirt land sand wind >> 5 1 4 2 5 9 >> >> how can I make it come out the same order I entered them? >> ie. >> dirt sand land air wind breath >> 4 5 2 5 9 1 >> >> Cheers, >> -Shannon >> >>> From: [EMAIL PROTECTED] (Rafal Pocztarski) >>> Newsgroups: perl.beginners.cgi >>> Date: Wed, 24 Oct 2001 16:04:19 +0200 >>> To: [EMAIL PROTECTED] >>> Subject: Re: Printing Hash Keys >>> >>> Shannon Murdoch wrote: >>>> >>>> What everyone has said so far is ways to list all the VALUES contained > in a >>>> hash array, what I need to do is list all the KEYS contained in the > hash >>>> array-with a tab (\t) between each. >>> >>> print join "\t", sort keys %hashname; >>> >>> - RaFaL Pocztarski, [EMAIL PROTECTED] >> >> >> -- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]