I'm guessing that ${SOURCE} and friends are being interpolated somehow (even though they're in single quotes)
Those quotes are processed by the shell. In the bourne shell or a derivative like bash, single quote don't perform any interpolation.
$ 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.
In reply to Re^2: Command line question
by ikegami
in thread Command line question
by igotlongestname
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |