my $g = shift; my $UserName = shift; print h1 "new $g->{NewPassWord}, old $g->{OldPassWord}"; # these details are shown to be correct my $pwd = new Apache::Htpasswd("/path/to/my/passwordfile"); #$pwd->htpasswd($UserName, $g->{NewPassWord}, $g->{OldPassWord}); # either with the line above or the line below it still goes wrong: $pwd->htpasswd($UserName, $g->{NewPassWord}, 1);