Use braces:
$db =~ s/_.+?_/_${dbname}_/; [download]
🦛
In reply to Re^3: Dereferencing in blessed object by hippo in thread Dereferencing in blessed object by Bod