Next Lightweight Databases 40

Fixed-Length Records

     billg   666  xyPXkPQTjCjnUGates               William
     mjd     119  A12FMTJGN5wpYDominus             Mark Jason
     longuser123453OUbq7V0pV9doLongusername-EarwiggFeatherstonehaughs
     larry   1    ..qQYY3gYY0yAWall                Larry
     ...

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


Next Copyright © 2003 M. J. Dominus