in reply to Checking Wrong Condition
$inp2 !~ /^file=\w+$/i
Compare with file=ccmsg.2 -- the dot does not match \w.