in reply to Re: Database Structure/Sorting/Displaying
in thread Database Structure/Sorting/Displaying

Hmmm. Ok, I didn't realize that was possible (but I shoulda figured... it's Perl :-) ). Here's a question though: if I don't have DB_File, and I want to display a range of numbers, say 614 - C18, how would I be able to do it without the sort field?
  • Comment on Re: Re: Database Structure/Sorting/Displaying

Replies are listed 'Best First'.
Re: Re: Re: Database Structure/Sorting/Displaying
by danger (Priest) on Jul 05, 2001 at 19:41 UTC

    Since you can sort on catalogue number, you can loop over the sorted keys and skip the ones not in the range:

    foreach my $key (@sorted) { next unless $key eq '614' .. $key eq 'C18'; print "$key: $db{$key} \n"; }

    Assuming the hash is %db. I suspect you were doing something similar but using the sort N field? The downfall is that you need to get the whole list of keys into memory --- with DB_File that could be avoided.