$ echo "${PATH}"
.:/home/ikegami/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/gam
+es
$ echo '${PATH}'
${PATH}
( Here on end, assuming the bourne shell or a derivative like bash )
So Perl sees
BEGIN { $^I = ''; }
while (<>) {
s+${SOURCE}/${SAMS}/++g;
s+${SOURCE}/${SAMLIB}/++g;
s+${SOURCE}/${SMCLIB}/+${SOURCE}/${KENO}/+g;
if ( not m+^${SOURCE}/+ ) {
s+${SOURCE}/+\$$\{OBJECT\}/+g;
print
}
}
On the other hand, Perl regexp and replace expressions *do* interpolate. So the above is equivalent to
BEGIN { $^I = ''; }
while (<>) {
s+//++g;
s+//++g;
s+//+//+g;
if ( not m+^/+ ) {
s+/+\${OBJECT}/+g;
print
}
}
Depending on what the OP wants to do, he needs to use -e"" instead of -e'', to escape the dollar signs, or to define those variables in Perl.
|