in reply to Can't use string ("250") as an ARRAY ref while "strict
my $tag = 'conditionning'; my $newval = '200'; my $data = join('', <DATA>); $data =~ s/(<$tag[^>]*>)[^<]*(<\/$tag[^>]*>)/$1$newval$2/gi; print $data; __DATA__ <category name="Coffee"> <heading>150 years of know how at the service of a same strategy: +Taste</heading> <photo>images/bag_legal.jpg</photo> <subcategory name="Prestige"> <photo>images/prestige.jpg</photo> <product>Coffee <brand>33</brand> <channel>D</channel> <channel>A</channel> <conditionning unit="gr">250</conditionning> <description>aaaa</description> <packaging_qty>12</packaging_qty> <product_id>8080</product_id> <recipe>/recipes/coffee1.html</recipe> </product> </subcategory> </category>
|
|---|