Mark Sutfin wrote, on Thursday, September 13, 2001 11:01 AM
: 30    update  table
: ...
: ...
: ...
: 100   begin
: 101   select  blah
: 102   from    tbl
: 103   where   foo=bar
: 104   end
: 
: I insert data into the hash using this.
: 
: $main{$line_count} = $line

You probably should choose a variable name other than 'main'.
'main' is the default namespace.

: As I need to be able to "backup" a couple of lines (to a line 
: that contains
: the most recent select, update, delete or insert for example) to 
: provide the
: user with all of the associated lines of code that don't meet a specific
: standard, I need to sort the values based on keys.... So I tried 
: this, just
: to verify the sort order...
: 
: foreach $key (sort keys %main)
: {
:       print $key, '=', $main{$key}, "\n";
: }
: 
: This sorts the hash, but the order is different than I expected. 
: It appears
: to be sorting on the key as if it were alphabetical, not numeric....? 

So sort numerically. Check the doc on sort: perldoc -f sort

Basically just replace the default sort (alpha) with numeric:

sort {$a <=> $b} keys %lines; # I replaced %main with %lines

Joe

==============================================================
          Joseph P. Discenza, Sr. Programmer/Analyst
               mailto:[EMAIL PROTECTED]
 
          Carleton Inc.   http://www.carletoninc.com
          219.243.6040 ext. 300    fax: 219.243.6060
 
Providing Financial Solutions and Compliance for over 30 Years
 
_______________________________________________
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web

Reply via email to