Here datause strict; use CGI ':standard'; use XML::Simple; use Data::Dumper; #Variables my $newval = 'Max'; my $categor = 'Vinegars'; my $oldval = 'Martin Pouret'; my $prodid = '600.54.01'; my $cats; if ($categor eq 'Coffee') { my $cat = (<DATA>); } elsif ($categor eq 'Vinegars') { $cats = (<DATA>); print "Hello world"; #exit 1; } elsif ($categor eq 'Seafood') { my $cat = (<DATA>); } elsif ($categor eq 'Pate') { my $cat = (<DATA>); } elsif ($categor eq 'Mustard') { my $cat = (<DATA>); } else { print "Sorry the category that you wanted to edited doesn' +t exist. Please contact your administrator. \n Thanks"; print "No data will be print"; exit 1; } my $cat = $cats; my $arrays = [qw/subcategory packaging_qty recipe descript +ion product paragraph comments channel brand conditionning product_id + heading photo/]; my $category = XMLin($cat, keyattr => 1, forcearray => $ar +rays); print Dumper($category)
===DATA=== <category name="Vinegars"> <subcategory name="Range Martin Pouret"> <comments><paragraph>Gourmet vinegar for Connoisseurs. Vin +egar as it was once and always should be!</paragraph></comments> <photo>images/vinegars.jpg</photo> <product>Vinegar <channel>D</channel> <channel>S</channel> <product_id>600.54.01</product_id> <brand>Martin Pouret</brand> <description>Red wine vinegar old reserve</description +> <conditionning unit="ml">500</conditionning> <packaging_qty>6</packaging_qty> </product> </subcategory> </category>
In reply to not well-formed (invalid token) by Maxim
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |