CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner: Re: [FishMonger] single to double quote conversion: Edit Log



FlayedOne
Novice

Jan 27, 2010, 7:04 AM


Views: 2877
Re: [FishMonger] single to double quote conversion

I changed all the looks stuff, and did this:


Code
 $regexp = qr/$regexp/;


which as I understood you meant. Of course this works well, and supposedly improves my scripts performance by preventing recompiling the string I get into regexp every time a match is attempted, but I can't see how I can solve my problem with qr. Unless I'm still missing something all it does is compile a string into a regexp, but when I'm doing a substitution:

Code
  s/$regexp/$string/g

while $regexp is supposed to be a regexp, and if it's a string it will get compiled to a regexp, but $string is supposed to be a string and not a regexp, and it's $string($changeto in my script) being treated literally that I have troubles with. How can compiling something to a regexp help?


(This post was edited by FlayedOne on Jan 27, 2010, 7:05 AM)


Edit Log:
Post edited by FlayedOne (Novice) on Jan 27, 2010, 7:05 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives