dbmopen ties the hash userinfo to the database, but you have not set how to handle. It assumes
AnyDBM_File which is a dummy framework, so exists is not implemented.
So inserting
use DB_File will solve it, but I'm not really sure this is the correct one.
PHP Code:
#!/usr/bin/perl -w
use strict;
use Digest::MD5 qw(md5_hex);
use CGI qw(:standard);
use DB_File; # <<== add this
...