I don't think this has anything to do with captures.
The error message seems to report an unitialised value in the string concatenation, which means that <$file> is returning undef. So why is your die not working? Try changing the low precedence operator or to ||.