On 11/7/07, Charlie Farinella <[EMAIL PROTECTED]> wrote: > perl -w -i -p -e "s/testtext/'<% \$bURL %>'/g" test.html > > ..substitutes '<% %>'
And yet, it didn't give you any warning? It sure looks like you're asking for warnings. I get two warnings, when I change your code thusly: $ perl -w -l -e "print qq/'<% \$bURL %>'/" Name "main::bURL" used only once: possible typo at -e line 1. Use of uninitialized value in concatenation (.) or string at -e line 1. '<% %>' I'm using a Unix-type shell; are you? In a Unix-type shell, double-quoted strings are different than single-quoted ones; most users prefer to use single quotes when writing programs on the command line. The shell seems to gave gobbled the backslash inside double quotes, leaving Perl looking in vain for the $bURL variable. Here's what happens if I reverse the singles and doubles in my test program: perl -w -l -e 'print qq/"<% \$bURL %>"/' "<% $bURL %>" This time, the single quotes told the shell to leave the backslash alone, so Perl saw (and didn't print) the backslash. Something like that is probably what you wanted, or you could add an extra backslash to satisfy the shell. If you're using a Windows-type shell, quoting rules are different, and double-quotes are generally used. In any case, check your shell's documentation to be sure you're giving it the quoting it needs. Perl itself gives many quoting options, such as the qq// generalized double quotes I used above. One reason they were invented is to make it easy to avoid certain characters (such as "quote marks") that may be important to a shell. Check the perlop manpage for the details on qq// and the other quoting operators within Perl. Hope this helps! --Tom Phoenix Stonehenge Perl Training -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/