Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

system("") + perl -pie = hell?

Status
Not open for further replies.

hardrocksr

Programmer
Joined
Aug 31, 2006
Messages
2
Location
US
I have a perl pie regex one liner that works:

perl -p -i -e 's/<[^\/]*cfquery/cfquery username=\x22#request.username#\x22 password=\x22#request.password#\x22/g' index.cfm

when i try to add it into a perl script i have, using the system call:

system("perl -p -i -e 's/<[^\/]*cfquery/cfquery username=\x22#request.username#\x22 password=\x22#request.password#\x22/g' index.cfm"

it doesn't work, throwing an error about unclosed brakets [ <---

I am sure it has somethign to do with string stuff and escaping the right special characters. I tried popping the strings into vars,escaping everything possible, used the \x hex vales, but none seemed to get me anywhere.

help. thanks.
 
Did you try closing the parenthesis?
 
yes, the line *should* read

system("perl -p -i -e 's/<[^\/]*cfquery/cfquery username=\x22#request.username#\x22 password=\x22#request.password#\x22/g' index.cfm");

it just didn't copy paste correctly.
 
thats because it evaluates part of the string in the double quotes before it runs the system command.
Change it to look like this

system(q~perl -p -i -e 's/<[^\/]*cfquery/cfquery username=\x22#request.username#\x22 password=\x22#request.password#\x22/g' index.cfm~);


``The wise man doesn't give the right answers,
he poses the right questions.''
TIMTOWTDI
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top