225

Managing DBM Files
DBM Exercise

  • Using only the knowledge that you have gained in the course to this point, try the following exercise:


    Exercise
    1. Copy the "each2" example into a file called "each3".
    2. Add code after the dbmopen function to
      1. Use a while-loop to repetitively read a line from STDIN
      2. Make sure you chop or chomp the input
      3. Split on white-space into two scalar variables
      4. Store the two values into the DBM file as key-value pairs
    3. Try running your each3 script several times and observe the output.

    each2

    each3