Robert Wohlfarth wrote:
> On Mon, Dec 7, 2009 at 10:29 PM, <trapd...@trapd00r.se> wrote:
> 
>> I'm fairly new to perl but loving it. I've run into some trouble though...
>> Trying to sort a hash by it's key value, which is not a problem by itself;
>>
>> foreach(my $key (sort keys %channels)) {
>>        print $key;
>> }
>>
>> What I've been struggling with for the last hour or so is how I could sort
>> the hash by it's key value and print out both the keys (sorted) and values
>> (not sorted). My last solution somewhat became a fork bomb and my computer
>> died. :)
>>
> 
> Does this code do what you want?
> 
> foreach(my $key (sort keys %channels)) {
>        print $key, ' => ', $keys{$key};

    print $key, ' => ', $channels{$key}, "\n";

> }
> 


-- 
Just my 0.00000002 million dollars worth,
  Shawn

Programming is as much about organization and communication
as it is about coding.

I like Perl; it's the only language where you can bless your
thingy.

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to