http://www.perlmonks.org?node_id=1016350


in reply to Re^3: Search and replace
in thread Search and replace

I thought I already had. :-) But OK, let’s add an /x modifier to the regex to make it easier to break apart:

$found =~ s/ ENV{\" # match the characters: ENV{" (.*?) # followed by any characters -- this sequence +is the "value", and the parentheses capture it into the special varia +ble $1 \"} # followed by: "} / \$ENV( # and substitute a literal: $ENV(" $1 # followed by the captured "value" \") # followed by: ") /gx; # and repeat the search & replacement to the e +nd of $found

Notes:

Hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

Replies are listed 'Best First'.
Re^5: Search and replace
by Bharath666 (Novice) on Feb 01, 2013 at 05:57 UTC

    Yeah!! I got it now :) Thanks a lot :)