|
#!/usr/local/bin/perl use strict; use warnings; use TextFileDB; use TextRecordConverter; my $cmdname = $0; $cmdname =~ s{.*/}{}; my $usage = "Usage: $cmdname isbn author title\n"; die $usage unless @ARGV == 3; my $isbn = shift; my $author = shift; my $title = shift; my %books; tie %books, 'TextFileDB', dbfile => 'mybooks', converter => TextRecordConverter->new( fieldnames => [qw(isbn author title)], ), keyfield => 'isbn'; $books{$isbn} = { author => $author, title => $title }; |
Die Implementierung assoziativer Arrays ist natürlich
nicht nur für indizierte Dateien denkbar, sondern auch
für traditionelle Textdatenbanken, wenngleich dies
weniger effizient ist.
|
Copyright © 1996 - 2003 Andreas Borchert, in HTML konvertiert am 01.10.2003 |