in reply to Manipulating a string in a tagged file
Hi rsriram, try like this,
use strict; use warnings; my $str = '<tag1>Complete</tag1><tag2>3386</tag2><tag3>77844</tag3><ta +g4>11</tag4><tag5>30</tag5><tag6>4.7</tag6>'; if($str =~ /<tag1>Complete<\/tag1>/i) { $str =~ s/<tag6>(.+?)<\/tag6>/"<tag6>".( $1 * 100 )."<\/tag6>"/ei; } print $str;
Updated
Typo error in your replacement statement. Use 'e' option modifier for execute the statement in the replacement part.
See the documentation for further clarification perlre
Regards,
Velusamy R.
eval"print uc\"\\c$_\""for split'','j)@,/6%@0%2,`e@3!-9v2)/@|6%,53!-9@2~j';
In Section
Seekers of Perl Wisdom