Of course it depends on how you want to use this code, but personally I would change the error message to go to stderr instead of stdout, and exit with something other than zero, which by convention means success. Both can be done using die:
print "There are build errors (see line $.)\n";
exit 0;