Perl:: mass replacement of converting C code formats to tgmath.h

hello,

i have a lot of C old code I'm updating to C11 with tgmath.h for generic math. the old code has very specific types, real and complex, like cabsl, csinhl, etc

usually for simple bulk replacements i would do something simple like this

perl -pi -e 's/cosl/cos/g' *.c

the reference is here

http://en.cppreference.com/w/c/numeric/tgmath

snippet

                   real                            complex
generic float    long dble dble dble  float   long dble  dble dble
fabs	   fabsf	fabs	    fabsl	  cabsf	cabs	     cabsl
exp	   expf	exp	    expl	  cexpf	cexp	    cexpl
log	   logf	log	    logl	  clogf	clog	    clogl

there are basically two classes of operations

array=(fabs exp log pow sqrt sin cos tan acos atan sinh cosh tanh asinh acosh atanh)
for tgt in array
{
perl -pi -e 's/${tgt}f/${tgt}/g' *.*
perl -pi -e 's/${tgt}l/${tgt}/g' *.*
perl -pi -e 's/c${tgt}/${tgt}/g' *.*
perl -pi -e 's/c${tgt}f/${tgt}/g' *.*
perl -pi -e 's/c${tgt}l/${tgt}/g' *.*
}
#special case of fabs
perl -pi -e 's/cabs/${tgt}/g' *.*

and

array=(atan2 cbrt ceil copysign erf erfc exp2 expm1 fdim floor fma fmax fmin fmod)
array+=(frexp hypot ilogb ldexp lgamma llrint llround log10 log1p log2 logb lrint)
array+=(lround nearbyint nextafter nexttoward remainder remquo rint roiund scalbin)
array+=(scalbn tgamma trunc carg conj creal cimag cproj)
for tgt in array
{
perl -pi -e 's/${tgt}f/${tgt}/g' *.*
perl -pi -e 's/${tgt}l/${tgt}/g' *.
}

perl is not mandatory, but a sweet one or two liner would be excellent.

thanks.

---------- Post updated at 04:36 PM ---------- Previous update was at 02:55 PM ----------

oh well, i went ahead my own my loops and forked.