[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] DB_File and odd behaivor



Hello,
I've been getting some strange results using the DB_file module abd was
wondering if was just me or if others are having this problem.  My scripts
are being very inconsistent when trying to print out the tied variables.As
a test for my sanity this I tried running the example from the DB_file
documentation:

 use strict ;
    use DB_File ;
    use vars qw( %h $k $v ) ;

    tie %h, "DB_File", "fruit", O_RDWR|O_CREAT, 0640, $DB_HASH
        or die "Cannot open file 'fruit': $!\n";

    # Add a few key/value pairs to the file
    $h{"apple"} = "red" ;
    $h{"orange"} = "orange" ;
    $h{"banana"} = "yellow" ;
    $h{"tomato"} = "red" ;

    # Check for existence of a key
    print "Banana Exists\n\n" if $h{"banana"} ;

    # Delete a key/value pair.
    delete $h{"apple"} ;

    # print the contents of the file
    while (($k, $v) = each %h)
      { print "$k -> $v\n" }

    untie %h ;

here is the output(according to the docementation):

    Banana Exists

    orange -> orange
    tomato -> red
    banana -> yellow

My Output however was simply:

Banana Exists


Any ideas?
I noticed threads in the archives for this list concerning DB_File and th
G3. I am on a G3 if that makes any difference.

Mark



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch