my %TEMP=(‘${TMP}‘=>‘SSS‘, ‘${PROJECT_ROOT}‘=>‘aaaaaaaa‘, ‘${MCB_PATH}‘=>‘bbbbbbbb‘, ‘${PATH}‘=>‘cccc‘, ‘${VERSION}‘=>‘ddddd‘ ); while(<DATA>){ s/(\$\{.+?\})/$TEMP{$1}/ while $_=~/\$\{.+\}/; print $_; } __DATA__ ${TMP}/lib/common ${PROJECT_ROOT}/release ${MCB_PATH}/ac_s110 ${PATH}/${VERSION}/libc
结果:
SSS/lib/common aaaaaaaa/release bbbbbbbb/ac_s110 cccc/ddddd/libc
本文出自 “RZL_01的博客” 博客,请务必保留此出处http://rzl01.blog.51cto.com/3004337/1586112
原文地址:http://rzl01.blog.51cto.com/3004337/1586112