Hi all,
I have this error error not "well-formed (invalid token)". I am a If.elsif.Else. I have to debug but I fail. Can you please help me to debug.
Here my code:
use 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)
Here data
===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>

Thanks Maxim

In reply to not well-formed (invalid token) by Maxim

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.