my $HTPASSWD_BIN = '/usr/bin/htpasswd'; # add .htaccess and .htpasswd files print "Writing .htaccess and .htpasswd files.....\n"; my $htpasswd_file = "$WWW_ROOT/$domain/.htpasswd"; my $htaccess = get_htaccess( $domain, $htpasswd_file ); print "$htaccess\n" if $VERBOSE; write_file( "$WWW_ROOT/$domain/public_html/private/.htaccess", $htaccess ); print `$HTPASSWD_BIN -b -c $htpasswd_file $domain $password`; print "Done!\n"; sub get_htaccess { my ($domain, $htpasswd ) = @_; return < require valid-user CODE }