Beispiel für eine sortierte indizierte Datei III

 [Vorheriges Kapitel]  [Vorherige Seite]  [Inhaltsverzeichnis]  [Nächste Seite]  [Nächstes Kapitel]

gencomposerdb.pl
while (<>) {
   chomp;

   my ($name, $birth, $death) = m{
         (.*?)             # name of the composer ---> $name
         \s+
         (?:
            (?:\d+\.){2}   # day and month of birth (ignored)
         )?
         (\d{4}|\?)        # year of birth ---> $birth
         -                 # delimiter between birth and dth
         (?:
            (?:\d+\.){2}   # day and month of death (ignored)
         )?
         (\d{4}|\?)?       # year of death ---> $death
         $
      }x;

   # complain if it didn't match

   unless (defined $birth) {
      print STDERR "$cmdname: invalid entry: $_\n";
      next;
   }

   $db->db_put($birth, "Born: $name")
      if defined $birth && $birth ne "?";
   $db->db_put($death, "Died: $name")
      if defined $death && $death ne "?";
}

 [Vorheriges Kapitel]  [Vorherige Seite]  [Inhaltsverzeichnis]  [Nächste Seite]  [Nächstes Kapitel]
Copyright © 1996 - 2003 Andreas Borchert, in HTML konvertiert am 01.10.2003