in reply to Compiling perl module

Let's assume it can find gcc, since that seems very likely. Based on the snippet posted by Anonyrmous (++), there are a couple of other obvious causes. Something in $flags could be unsupported, or maybe the gcc install is broken. In both cases, something useful should be in compilerok.log.

The simplest solution might be to install your own Perl rather than trying to address incompatibilities between your gcc and the one used to build your perl. App::perlbrew is a convenient way of locally installing a version of Perl.