Next Lightweight Databases 41

Fixed-Length Records

          while (read($fh, my($rec), 64) == 64) {
            ...
          }
        sub find_user {
          my ($fh, $user) = @_;
          seek $fh, 0, SEEK_SET;
          local $/ = \64;        
          while ($rec = <$fh>) {
            my (@field) = unpack "A8 A5 A13 A20 A18", $rec;
            next unless $user eq $field[0];
            return @field;
          }
          return;
        }


Next Copyright © 2003 M. J. Dominus