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
时间: 2024-12-11 06:12:43