in reply to Re^4: getting a regex to return an array of matches?
in thread getting a regex to return an array of matches?

Because my with a conditional is buggy (and makes no sense). In your case, the following will do nicely:
my ($var) = $filecontents =~ /SOME_REGEX(.*?)$/g; if (defined $var) { ... proceed w/ usage of $var }