What is in $regex?
try
$line =~ /$regex/; [download]
In reply to Re: Regex stored in a scalar by 1nickt in thread Regex stored in a scalar by OtakuGenX