Hi,
I'm starting to look at perl db's, and I ran across 
something, but I'm not sure what it's about.
I have questions.

In the below code, if I comment out "use DB_File";
I get an unsorted printout, and only 2 files are
created, dbmdatabase.dir  and dbmdatabase.pag.
Everything seems fine.

If I leave "use DB_File" in, I get back a sorted
printout, and 3 files are produced, the above mentioned
2, and plain dbmdatabase.

So,  is it acceptable to use db without "use DB_File";
or if I do use it, can I always count on the automatic
sorting?  The docs seem to say that hashes will come back
unsorted without a sort routine.
        

#############################################################
#!/usr/bin/perl
use warnings;
use strict;
use DB_File;

my (%Z,$i,$j);
dbmopen(%Z,"dbmdatabase",0644) || die "cannot open DBM dbmdatabase: $!";
for $j ('a'..'e'){
      for $i (1..20){
      $Z{$j.$i} = $j.$i.$j;                    
}}

while ((my $key,my $value) = each(%Z)) {
    print "$key has value of $value\n";
    }    

dbmclose %Z;    
##########################################################



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to