Perl and Databases
You need to learn a little bit about how Perl handles databases. Perl contains a tie function that connects a variable with a package. For example, let’s tie the Perl variable %db to the DB_File package as follows:
use DB_File; tie(my %db, 'DB_File', 'my_info.db');
This tells Perl that all accesses to the hash %db are to be turned into method calls to the package DB_File. This means that now the following statement is actually a function call:
$db{password} = "Surfs Up";
The function is provided by the DB_File package. This package is one of the many small databases available for Perl. In fact, this one comes with the core Perl distribution. When this package sees this statement, it stores a new key/value pair in the database. ...
Get Perl for C Programmers now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.