Warning message:
Use of uninitialized value in numeric comparison (<=>) at ...
Code:
foreach (sort { $dHash{$b}{'VAL} <=> $dHash{$a}{'VAL'} } keys %dHash) {
How do I fix? Should my sort function be checking for variable
defined? What do I return on undefined?
--
To unsubscribe, e-mail: [EMAIL P
On Wed, Apr 25, 2007 at 01:37:24AM -0400, yitzle wrote:
> Warning message:
> Use of uninitialized value in numeric comparison (<=>) at ...
>
> Code:
> foreach (sort { $dHash{$b}{'VAL} <=> $dHash{$a}{'VAL'} } keys %dHash) {
perhaps
foreach (sort { $dHash{$b}{'VAL'} <=> $dHash{$a
On 4/25/07, yitzle <[EMAIL PROTECTED]> wrote:
Warning message:
Use of uninitialized value in numeric comparison (<=>) at ...
Code:
foreach (sort { $dHash{$b}{'VAL} <=> $dHash{$a}{'VAL'} } keys %dHash) {
How do I fix? Should my sort function be checking for variable
defined? What do I return on
Inside the loop I check if the value is defined, so I don't care where
in the order the undefined one shows up in. I don't want to delete
undefined ones or anything...
On 4/25/07, Chas Owens <[EMAIL PROTECTED]> wrote:
On 4/25/07, yitzle <[EMAIL PROTECTED]> wrote:
> Warning message:
> Use of uni
On 4/24/07, yitzle <[EMAIL PROTECTED]> wrote:
Warning message:
Use of uninitialized value in numeric comparison (<=>) at ...
Code:
foreach (sort { $dHash{$b}{'VAL} <=> $dHash{$a}{'VAL'} } keys %dHash) {
How do I fix?
Give it an initialized value. Maybe like this?
sort { ($dHash{$b}{VAL} ||
On 4/25/07, yitzle <[EMAIL PROTECTED]> wrote:
Inside the loop I check if the value is defined, so I don't care where
in the order the undefined one shows up in. I don't want to delete
undefined ones or anything...
Then you can either turn off the warnings for that section (not
advised), ignore
yitzle wrote:
On 4/25/07, Chas Owens <[EMAIL PROTECTED]> wrote:
On 4/25/07, yitzle <[EMAIL PROTECTED]> wrote:
Warning message:
Use of uninitialized value in numeric comparison (<=>) at ...
Code:
foreach (sort { $dHash{$b}{'VAL} <=> $dHash{$a}{'VAL'} } keys %dHash) {
How do I fix? Should my
yitzle wrote:
Inside the loop I check if the value is defined, so I don't care where
in the order the undefined one shows up in. I don't want to delete
undefined ones or anything...
On 4/25/07, Chas Owens <[EMAIL PROTECTED]> wrote:
On 4/25/07, yitzle <[EMAIL PROTECTED]> wrote:
> Warning messag
In that case just create a list of the keys with a defined VAL value
before you do the sort:
my @keys = grep defined $dHash{$_}{VAL}, keys %dHash;
foreach (sort { $dHash{$b}{VAL} <=> $dHash{$a}{VAL} } @keys) {
print $_, "\n";
}
HTH,
Rob
This solution appeals to me. I'll use it. Tha
yitzle wrote:
P.S. What's HTH?
Hope This Helps :)
Rob
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
10 matches
Mail list logo