In order to use a 'soft' reference such as this, you'll have to turn off strict refs:
#!/usr/bin/perl -w
use strict;
sub filename($){
print "it worked!\n";
}
my $dbh;
my $filename = 'filename';
no strict 'refs';
&{$filename}($dbh);
use strict 'refs';