Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > warnings on sorting hash of hashes

Reply
Thread Tools

warnings on sorting hash of hashes

 
 
sam
Guest
Posts: n/a
 
      01-05-2005
Hi,

I got the following warnings when doing sorting a hash with hashes:

Use of uninitialized value in numeric comparison (<=>) at hash-hash.pl
line 22.
Use of uninitialized value in numeric comparison (<=>) at hash-hash.pl
line 22.
Use of uninitialized value in numeric comparison (<=>) at hash-hash.pl
line 22.
Use of uninitialized value in numeric comparison (<=>) at hash-hash.pl
line 22.
Use of uninitialized value in numeric comparison (<=>) at hash-hash.pl
line 22.
Use of uninitialized value in numeric comparison (<=>) at hash-hash.pl
line 22.


#!/bin/usr/perl -w

#use warnings;

my %products = (
1 => {
name => "Floor Wax",
wholesale => "50.00",
retail => "75.00",
},
2 => {
name => "Paper Towel",
wholesale => "20.00",
retail => "40.00",
},
3 => {
name => "Hand Soap",
wholesale => "30.00",
retail => "65.00",
},
);

foreach my $key (sort {$products{retail}{$a} <=> $products{retail}{$b}}
keys %products) {
print "\n<br>K|$key| N|$products{$key}{name}|
W|$products{$key}{wholesale}| R|$products{$key}{retail}|";
}
print "\n";

What is wrong with line 22 on the line of "foreach...."?

Thanks
Sam.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
"Pseudo-hashes are deprecated" error and accessing a hash of hashes ernestm@mindspring.com Perl Misc 3 01-31-2006 04:40 AM
Sorting a hash containing a hash of hashes IanW Perl Misc 3 12-14-2005 03:02 PM
Hash of hashes, of hashes, of arrays of hashes Tim O'Donovan Perl Misc 5 10-28-2005 05:59 AM
Hashes of hashes or just one hash ? Perl Learner Perl Misc 11 06-09-2005 06:55 AM
Performance Improvement of complex data structure (hash of hashes of hashes) Scott Gilpin Perl Misc 2 08-26-2004 01:02 AM



Advertisments