Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: use qr// variable in right side of s/// operator

by mk. (Friar)
on Feb 15, 2006 at 12:10 UTC ( [id://530352]=note: print w/replies, xml ) Need Help??


in reply to use qr// variable in right side of s/// operator

maybe try using eval()?!
$old_db="emdb1"; $new_db="kuku"; $string="AUTHORIZATION,libctl62-m.sl,CONTROLM,emdb1,b02ed6600206ca161d +165355c67b72073b6123d6838f1f68203b78cb9c4c63c9,emdb2,,;" ; $str_regexp = "\$1\$2\$3${new_db}," ; $string=~eval(s/([^,]*,)([^,]*,)([^,]*,)([^,]*,)/$str_regexp/e); print "${string}\n";


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@

Replies are listed 'Best First'.
Re^2: use qr// variable in right side of s/// operator
by psimonovsk (Novice) on Feb 15, 2006 at 14:02 UTC
    Hi mk! I tried... $string remains unchanged... It is also interesting question - that I have no ansver - why... But any way - it does not solve a problem...
      oh, i'm sorry, i guess i'd misunderstood your problem.
      $old_db="emdb1"; $new_db="kuku"; $string="AUTHORIZATION,libctl62-m.sl,CONTROLM,emdb1,b02ed6600206ca161d +165355c67b72073b6123d6838f1f68203b78cb9c4c63c9,emdb2,,;" ; $string =~ s/$old_db/$new_db/g; print $string;
      does it work properly now?!
      =)


      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      @

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://530352]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2024-04-25 16:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found