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?!
      =)


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