Next Lightweight Databases 58

delete_user Revisited

        sub delete_user {
          my ($file, $target_user) = @_;
          for my $n (0 .. $#$file) {
            my ($user) = split /:/, $file->[$n];
            next unless $user eq $target_user;
            splice @$file, $n, 1;
            last;
          }
        }
        sub delete_user {
          my ($file, $target_user) = @_;
          @$file = grep !/^$target_user:/, @$file;
        }


Next Copyright © 2003 M. J. Dominus