Ponnam
The file you are trying to create already exists as a text file and so
cannot be created as a DB - which is why it fails. Open the team.txt first
and pass the value into a hash/array/variables first and then push values
into the  db. the db should be called something else. 
se warnings ;
    use strict ;
    use DB_File ;
    use Fcntl ;
    our ($dotdir, $HISTORY, %hist_db,$user, $team) ;
    # you'll get the values below from a text file into anything here i've
shown a hash    
    my %hist = ("abnsb" =>"asghghas", "asggsag"=> "sshghs");
    $dotdir = "c:\\whatever";
    $HISTORY = "$dotdir\\team.dbm";
    tie %hist_db, 'DB_File', $HISTORY
        or die "Cannot open $HISTORY: $!\n" ;;
        foreach $user (keys %hist) {
                    
        $hist_db{$user}=$hist{$user};
        }    
        # Dump the complete database
    while ( ($user, $team) = each %hist_db ) {
        print "$user, $team\n" ;
    }
    untie %hist_db ;


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, May 13, 2002 5:01 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Doubt in DB_File module


Dear friends,
            When i  am trying to process the flat database using the DB_File
, it is giving the error like this ,
                  Cannot open C:\CC-LIC-USAGE\teams.txt: File exists

            How will i get the values from the existing file. Is it possible
or not.
            Expecting your valuable suggestions. Please ...


<CODE>

Contents in the teams.txt file

pons  TEAM1
ram   team2

 use warnings ;
    use strict ;
    use DB_File ;
    use Fcntl ;
    our ($dotdir, $HISTORY, %hist_db, $user, $team) ;
    $dotdir = "C:\\CC-LIC-USAGE";
    $HISTORY = "$dotdir\\teams.txt";
    tie %hist_db, 'DB_File', $HISTORY
        or die "Cannot open $HISTORY: $!\n" ;;
    # Dump the complete database
    while ( ($user, $team) = each %hist_db ) {
        print "$user, $team\n" ;
    }
    untie %hist_db ;



Expecting  your wishes,
Pons.
____________________________________________________
Ponnambalam. M.A.
Philips Medical Systems,
Philips Innovation Campus,
#1,Murphy Road, Ulsoor.
Bangalore - 560008. INDIA
Phone : +91- 080 - 557 9000 Extn: 1013
E-mail: [EMAIL PROTECTED]
____________________________________________________

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to