On Sat, Feb 28, 2009 at 07:13, Chas. Owens wrote:
snip
> Depends on your version of Perl. Perl prior to 5.8.1 the order of a
> set of keys in a hash was always the same (but unordered).
snip
This should read:
Perl prior to 5.8.1 the order of a set of keys in a hash was
always the same (
Jim Gibson wrote:
On 2/27/09 Fri Feb 27, 2009 8:33 AM, "Rick"
scribbled:
Jim Gibson wrote:
On 2/26/09 Thu Feb 26, 2009 3:53 PM, "John W. Krahn"
scribbled:
I get "Use of uninitialized value in numeric gt (>) at ..." for that, since
@max is undefined the first time through the
Jim Gibson wrote:
NO it is not. The way to diagnosis this type of problem is to look at the
contents of your variables, either by stepping through your program with a
debugger or by adding print statements to your program. If you do that, you
will find that the @next array is not assigned the key
On 2/27/09 Fri Feb 27, 2009 8:33 AM, "Rick"
scribbled:
> Jim Gibson wrote:
>> On 2/26/09 Thu Feb 26, 2009 3:53 PM, "John W. Krahn"
>> scribbled:
>>
>> I get "Use of uninitialized value in numeric gt (>) at ..." for that, since
>> @max is undefined the first time through the loop. Here is
Jim Gibson wrote:
On 2/26/09 Thu Feb 26, 2009 3:53 PM, "John W. Krahn"
scribbled:
I get "Use of uninitialized value in numeric gt (>) at ..." for that, since
@max is undefined the first time through the loop. Here is a version using
each that doesn't produce that error. It uses the fact th
On 2/26/09 Thu Feb 26, 2009 3:53 PM, "John W. Krahn"
scribbled:
> Rick wrote:
>> trying out getting lasrgest key(by value) but below is not working...
>>
>> help please.
>>
>> my %files=%{{"one" =>"1", "thiry" =>"30", "four" =>"4", "never" =>"997",
>> "forever" =>"11", "five" =>"5"}};
>>
Rick wrote:
trying out getting lasrgest key(by value) but below is not working...
help please.
my %files=%{{"one" =>"1", "thiry" =>"30", "four" =>"4", "never" =>"997",
"forever" =>"11", "five" =>"5"}};
my $max;
print join(" ",keys %files),"\n";
=pod
grep($max=($files{$_} > $max )? $_ : $
Rick wrote:
trying out getting lasrgest key(by value)
my %files=%{{"one" =>"1", "thiry" =>"30", "four" =>"4", "never" =>"997",
"forever" =>"11", "five" =>"5"}};
Any special reason why you say
my %files = %{{ ... }};
instead of simply
my %files = ( ... );
?
While this sugge
Will try that once I get back
--Original Message--
From: Owen
To: beginners@perl.org
Subject: Re: picking largest key by value..
Sent: Feb 26, 2009 3:53 PM
On Thu, 26 Feb 2009 15:34:11 -0500
Rick wrote:
> trying out getting lasrgest key(by value) but below is not working...
>
Rick wrote:
trying out getting lasrgest key(by value) but below is not working...
help please.
my %files=%{{"one" =>"1", "thiry" =>"30", "four" =>"4", "never"
=>"997", "forever" =>"11", "five" =>"5"}};
my $max;
print join(" ",keys %files),"\n";
=pod
grep($max=($files{$_} > $max )? $_ : $
On Thu, 26 Feb 2009 15:34:11 -0500
Rick wrote:
> trying out getting lasrgest key(by value) but below is not working...
>
> help please.
>
> my %files=%{{"one" =>"1", "thiry" =>"30", "four" =>"4", "never"
> =>"997", "forever" =>"11", "five" =>"5"}};
> my $max;
> print join(" ",keys %files),"
On 2/26/09 Thu Feb 26, 2009 12:34 PM, "Rick"
scribbled:
> trying out getting lasrgest key(by value) but below is not working...
>
> help please.
>
> my %files=%{{"one" =>"1", "thiry" =>"30", "four" =>"4", "never" =>"997",
> "forever" =>"11", "five" =>"5"}};
> my $max;
> print join(" ",key
trying out getting lasrgest key(by value) but below is not working...
help please.
my %files=%{{"one" =>"1", "thiry" =>"30", "four" =>"4", "never" =>"997",
"forever" =>"11", "five" =>"5"}};
my $max;
print join(" ",keys %files),"\n";
=pod
grep($max=($files{$_} > $max )? $_ : $max,keys %fil
13 matches
Mail list logo